Linux

Categorized | Networking, cli

Quick and easy sharing of a directory over HTTP in Linux

Say you want to share a folder for a friend. What better way than pointing him to an URL? Put this in your .bash_profile and login to your account.

alias webshare=‘python -c ”import SimpleHTTPServer;SimpleHTTPServer.test()”‘

Now cd to the directory in question a do a simple webshare command. That folder will be accessible from any browser by typing http://your_ip:8000
Alternatively, you can use Droopy.

Author Profile

T4L ;

Other posts by T4L

Author's web site



Are you satisfied with this blog?
Why not subscribe our RSS Feed? you will always get the latest post.


5 Comments


  1. Another alternative for this sort of thing is ‘Woof’ (http://www.home.unix-ag.org/simon/woof.html), which allows a file to be served via HTTP. It also works with directories, but in that instance Woof serves a tarball of the contents of the specified directory as a single file. Woof is also able to serve up a copy of itself, enabling the other party to subsequently offer a file back to you.

    1
  2. Smitty

    Of course you ignore all the firewall and directory/file permission issues, but hey, let’s not quibble about such trivialities

    2
  3. T4L

    This tip wasn’t about firewall configuration. It’s just like saying about a mencoder tip that the text doesn’t mention you can also use ZSH to do the job.

    3
  4. Smitty

    My point is - there is no such thing as a “Quick and easy sharing of a directory over HTTP in Linux”, unless you also want to run in a completely unsecured environment. I’ll agree that the one liner to set up the http share is trivial, but then so is adding a Samba share, or an SFTP folder, or for that matter, a WebDav share. All of these activities could also be performed by a single shell commandline (although they would involve multiple commands on the single line.) Don’t get me wrong; it’s good to see articles like this that help people understand the types of tools that are available but I think you have trivialized the issue by not mentioning the other aspects of making files public.

    4
  5. Michael

    Great tip, but actually python’s SimpleHTTPServer and Droopy have opposite uses. As you state, this webshare alias will allow others to retrieve files FROM you computer. Droopy is only for others to upload files TO your computer.

    5

1 Trackback(s)

  1. 14 01 2009 : Easy way to send files from Windows to Linux « Linux & Stuff

Leave A Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>