In the world of Ubuntu, it seems you either always run an FTP server or you never do. Perhaps I'm the first network analyst who's needed to flash a Cisco, Checkpoint or Nokia image using Ubuntu... I need an FTP server for maybe 5 minutes, no more than that.
I'm looking for a bare-bones, user-initiated FTP server. I understand that it would likely have to run with sudo. That's fine - but I want to start/stop it like a normal program.
On the Windows platform, such tools are a dime a dozen - I've used 3CDaemon for years and recently found CoreFTP. Both are excellent. You configure a user, point it at a directory, then hit the "Start" button. A couple of minutes later, you're generally done and you hit the "Stop" button. Job done.
Such tools don't seem to exist on Ubuntu. I found a Google Code project that creates a TFTP instance reasonably nicely (assuming it still runs - I haven't used it in about a year and python has moved on), but how about FTP? Anything out there?
You can get an FTP server going as easy as one two three using pyftpdlib:
pip install --user pyftpdlib
python -m pyftpdlib
, add-w
if you want write access too.You now have an ftp server which you can log in to anonymously sharing your home directory. This is meant more as a test of the module, but it does what it says on the tin.
This command:
will serve, without root privileges, on port 2121 and grant write access to anonymous users. It will also use the directory
FTP
in the current working directory instead of your home. Typepython ftpserver.py --help
to get information about all the options.anonymous@localhost:2121/
Please note that this software is released under the terms of the MIT License, which means you can do basically what ever you please with it. Read the license text, it's only a few lines, and know your rights.
Now, this script doesn't support username and password as part of it's stand-alone functionality (for security reasons I imagine).
So I've added that feature:
You now have, in addition to all options I mentioned, the command line parameters
--username=USERNAME
and--password=PASSWORD
:Again, use
--help
to see them all.This should be as easy as it gets.
I've also written a little gui for it:
Download it here (updated at rev. 6)
I'm sorry it's 3999 lines long, but it will do everything the original does. And i wanted to keep it all in one file. When it's started without any parameters (i.e. make it executable and double click it, or create a launcher for it), it starts a little gui for you to configure your server. You can still import it as a python module or use the above command line fu.
Known issues:
I've not bothered with anything other than port 2121. This should be simple, making the port configurable requires complex error handling which I don't want the user to bother with. 2121 should always work fine.
It won't warn you, like the command line does, about using an insecure configuration. I.e. not setting a password or something like that.
EDIT: since the API of
pyftpdlib
andftpserver.py
changed (and the ubuntu pastebin links are gone); most of the above post doesn't work anymore. For the (2014) version ofpyftpdlib
, use this script (ftpserver-cli.py
) to achieve the same as above:call with:
You can use pure-ftpd
You can use scp if you have an ssh server.
For those who copy files to and from routers you might want to try out this tool: tftpgui
It worked for me and is very easy to configure. It is also a Python script but does tftp instead of ftp. All you have to do is install python-tk and download the script
The only thing to be aware of is that Ubunutu defaults to Phython2 so the best way to start the script is:
You can then configure it in the GUI. when you are done you press exit and that is it.
Bo