April 25, 2012 will

Serve FTP with Python and PyFilesystem

Ben Timby has committed code to PyFilesystem that lets you expose any filesystem over FTP. We've had the ability to serve filesystems over SFTP (secure ftp) and XMLRPC for a while, but plain old FTP was a glaring omission–until now.

You can serve the current directory programatically with something like the following:

from fs.expose.ftp import serve_fs
from fs.osfs import OSFS
serve_fs(OSFS('.'), '', 21)

The same functionality is also available to the fsserve command. The following is equivalent to the above code, but from the command line:

fsserve -t ftp .

You'll probably need root privileges (i.e. sudo) on Linux for these examples.

With the server running, you can browse the files on your home directory with an ftp client, or by typing “” in to your browser. Any of the other supported filesystems can be served in the same way.

FTP has been around since the dawn of the internet, so just about any network enabled device will be able to access files exposed this way. It's a great way of creating a gateway to other filesystems. You could expose files stored on Amazon S3 for example.

You'll need to check out the latest code from SVN to try this out.

Update: Ben has posted more about this.

Use Markdown for formatting
*Italic* **Bold** `inline code` Links to [Google](http://www.google.com) > This is a quote > ```python import this ```
your comment will be previewed here
Ben Timby
I posted a bit more information on this same subject on my blog as well.

So - will we see version 0.5.0 soon?
I'll give this a mention at PyConUk - I rather like this package - and it's intent. Building a mount fs, serving it up over FTP/SFTP makes things a doddle.

The importhook is actually quite amazing too.
Will McGugan
The version in trunk has come a long way. We have Python 3 compatibility now. A new release is probably overdue…
Hi Will,

I am really impressed by pyfilesystem. It made me write my own virtual system filesystem implementation in a day.

But there is a big problem with google account requirement.

Please, move the project to github (or bitbucket). Google is evil and svn is totally obsolete now.