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('.'), '127.0.0.1', 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 “ftp://127.0.0.1” 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.

This blog post was posted to It's All Geek to Me on Wednesday April 25th, 2012 at 10:09AM
 

1 Response to "Serve FTP with Python and PyFilesystem"

Leave a Comment

You can use bbcode in the comment: e.g. [b]This is bold[/b], [url]http://www.willmcgugan.com[/url], [code python]import this[/code]
Preview Posting...
Previewing comment, please wait a moment...

My Tweets

Will McGugan

My name is Will McGugan. I am an unabashed geek, an author, a hacker and a Python expert – amongst other things!

Search for Posts
Possibly related posts
Tags
Popular Tags
 
Archives
2012
 
Recent Comments
Hi, I have a slideshow from image1-image5, and I want start slideshow from image 2. How can i do it ...
Hi, Normal, it's slide from image 1 - image 5But if i want select image 2 by function : render_image(image2, ...
Shame on me for the typos; it should have been: canvas id=“kenburns” width=“640” height=“480”/canvasas opposed to the CSS styling for ...
I haven't had a chance to test this yet in anything but FF and Safari, but I was able to ...
Thank you for this fantastic code. I've only tested this in FF and Safari I've created a viewport image and ...
 
© 2008 Will McGugan.

A technoblog blog, design by Will McGugan