Ad Hoc file sharing with SimpleHTTPServer
This is just a short memo about handy python module, called SimpleHTTPServer. Sometimes I need a way to quickly share some files with co-worker, without copying and/or creating shared folder. All I need is a quick way to allow someone read-only access to a specific folder. Let’s say that security is of no concern to me in such situation, since I’m talking about giving access to publicly available files anyway, such as drivers, installation files etc.
One neat way is to use python module SimpleHTTPServer.
All that is needed is this one-liner:
T:\Download>python -m SimpleHTTPServer Serving HTTP on 0.0.0.0 port 8000 ... alesk.domain.com - - [02/Feb/2009 18:13:49] "GET / HTTP/1.1" 200 - alesk.domain.com - - [02/Feb/2009 18:14:03] "GET /Accton/ HTTP/1.1" 200 - alesk.domain.com - - [02/Feb/2009 18:14:13] "GET /Accton/EN1207DTXv133.zip HTTP/1.1" 200 -
And the files will be available at http://yourhost:8000. Simply close the console after you’re done and http server will stop serving.
Last final note: be extremely careful that you cd to directory of interest, thus limiting access to only a particular directory. Remember that anyone with network access to your machine can access those files without authentication.