Which lightweight HTTP or FTP Server is good for simple file transfer?

25

7

This question is a followup to How to copy files to an untrusted computer?, as there doesn't seem to be a dedicated app for this purpose, I am now searching for a http or ftp server as an alternative. More specifically I am searching for a lightweight server that is usable for simple one-time file transfer between computers. By that I mean it should act as rsync/scp replacement to get files from one computer to another, not as a classic web server. Furthermore it should:

  • run in userspace
  • be trivial to configure (i.e. no config file, everything doable via command line)
  • support username/password
  • support continuation of downloads
  • support the export of single files instead of whole directories

dbr's answer to the previous question gets close, but is of course just an ad hoc hack that lacks many useful features.

Grumbel

Posted 2009-09-19T00:26:33.333

Reputation: 3 100

Question was closed 2013-08-11T12:06:39.467

Just use Apache2 it faster than python SimpleHTTPServer about 4x. – o0omycomputero0o – 2016-02-11T02:57:58.120

Answers

31

I'm often using this quick Python hack to serve a directory over HTTP.

python -m SimpleHTTPServer &

will serve the current directory.

By default, it binds to port 8000.

To choose another port:

python -m SimpleHTTPServer 9090 &

If you choose a port lower than 1024 on *nix, you might need root privileges, otherwise bind() will fail.

geek

Posted 2009-09-19T00:26:33.333

Reputation: 7 120

3Really not sure why this question was closed. The question and the answer were both very useful. – merlin2011 – 2013-11-09T22:26:03.657

8Or the Python 3 equivalent: python3 -m http.server – Eliran Malka – 2014-02-14T21:00:56.413

6

Someone on SO pointed me at Woof. A minimal httpd in python with an interface optimized just for such uses. It doesn't actually meet all your requirements, but by allowing you to specify the number of times it will connect it allows you to use the "Are you ready? I'm starting the server now." approach to securing the transfer.

To allow one (1) connection to download thisfile on port 8080, you just run

$ woof thisfile

It's that easy.

Here is the rather abused original. If you like it, go vote for Nate.

dmckee --- ex-moderator kitten

Posted 2009-09-19T00:26:33.333

Reputation: 7 311

Also works great for "upload" (in case you need a file from a user that can't or won't install a server themselves) – golimar – 2018-12-24T17:47:29.420

3

You can try webfs which is available through the Ubuntu repository:

Webfs (a.k.a. webfsd) is a simple HTTP server for purely static content. You can use it to serve the content of an FTP server via HTTP, for example. It can also be used to quickly export some files by starting an httpd server in a few seconds, without editing config files first.

Another option is HFS (Http File Server), a Windows app that works well through Wine.

HFS (Http File Server) is file sharing software which allows you to send and receive files. You can limit this sharing to just a few friends, or be open to the whole world. HFS is different from classic file sharing because there is no network. [...] Since it is actually a web server, your friends can download files as if they were downloading from a website using a web browser.

user4358

Posted 2009-09-19T00:26:33.333

Reputation:

HFS also works great for "upload" (in case you need a file from a user that can't or won't install a server themselves) – golimar – 2018-12-24T17:48:52.663

1What's up with the down votes here? The OP asked for simple http servers, and people have offered them. So what is the problem. – dmckee --- ex-moderator kitten – 2009-09-19T02:02:48.693

1

Please ignore if you are not open to alternatives, but the fact that you are willing to install a HTTP server with no preferences shows me that you want to get the job done of transfering a file more so than how it is done -

May I recommend that you install a FTP server?

It will allow you to pretty much do everything you require and is usually very easy to set up,you can even configure the port to use 80 if that is a requirement.

William Hilsum

Posted 2009-09-19T00:26:33.333

Reputation: 111 572

I have to agree. And solutions like Pure-FTPd make a lot more sense, than file transmission across http. – A Dwarf – 2009-09-19T01:01:27.860

1FTP would of course be fine too, but most FTP servers I know aren't exactly lightweight and come with plenty of ugly extra baggage that makes them unfit for simple one time file transfers (i.e. require root rights, accounts on the machine for password access, unflexible directory handling, etc.). With Pure-FTPd I couldn't even figure out how to start it as non-root user. – Grumbel – 2009-09-19T01:28:16.813

1Agreed. It's called File Transfer Protocol for a reason. HTTP, on the other hand, is HyperText Transfer Protocol. Chances are you're not interested in HyperText right now. – Lee B – 2009-09-19T01:37:31.963

But SFTP would be better. Personally I find rsync over ssh just fine. – Lee B – 2009-09-19T01:39:16.857

1FTP is not a stupid idea, but have you a suggestion for one that is a bog simple to set up as the OP has requested? – dmckee --- ex-moderator kitten – 2009-09-19T02:01:29.660

@LeeB: sftp/rsync/scp would require having direct access to the other host, which I don't have, see original question for more detailed explanation. – Grumbel – 2009-09-19T02:13:16.787

1The advantage of http is that each and every general use computer has a web browser on it, and the user will be comfortable using it. OK, it supports ftp too, but if your going to use a web browser anyway... – dmckee --- ex-moderator kitten – 2009-09-19T02:18:03.410

in my opinion, a ftp server is a lot easier to set up than a http one, and I know of several OS's with no browser (some without even links!) but all of these (and I can't think of many that don't) have a command line ftp program. I am trying to find a easy to use ftp program now - I only know of easy ones for Windows. – William Hilsum – 2009-09-19T02:31:28.240

2Wil, we're not talking about general purpose servers like Apache here. We're talking about special-purpose, minimal tools. Woof makes chttpd look heavy. – dmckee --- ex-moderator kitten – 2009-09-19T02:36:16.423

0

May I recommend http://code.google.com/p/pyftpdlib/ ?
It's light-weight, download the source, and write a Python script(just copy the quick start part on the home page is enough, 5-6 lines, set user name and password, home directory, etc.)
I use it for personal pc to pc file transfer(On Ubuntu Hardy). one known issue (and I can bear it with) is it can't handle Unicode(non-ASCII) well.

sunqiang

Posted 2009-09-19T00:26:33.333

Reputation: 101

0

The answer is simple: thttpd. It wins hands-down in performance, memory usage, and security. And by security I mean it's secure by virtue of competent design and not doing anything stupid, not that it has all sorts of "security" bells and whistles. It's also near-optimal with respect to size and simplicity.

If you need even smaller and simpler, BusyBox has a httpd applet that might also meet your needs.

I'm not sure if they meet some of your more off requirements like serving single files, but you can do that with a wrapper that puts symlinks in the http root. If you do this with thttpd, however, you'll have to disable symlink restrictions.

(I know this question is old, but it's a top result on Google and the existing answers are anything but light-weight.)

R.. GitHub STOP HELPING ICE

Posted 2009-09-19T00:26:33.333

Reputation: 1 783

2thttpd used to be my favorite answer too, but it was removed from Debian, Ubuntu, and RedHat in 2011 because it was "orphaned, has release-critical bugs, and is dead upstream." I wouldn't recommend it anymore. – poolie – 2013-04-26T04:59:52.633

0

You can also try HFS also called HTTP File Server ( http://www.rejetto.com/hfs/) While its is a windows application, it is said to work well using WINE. Its very low maintenance and even complete novices who don't even know what a File Server is will be able to use it without much effort. It supports drag and drop functionality and you can even control which IP addresses can access the files and supports users accounts and download speed control.

TenaciousD

Posted 2009-09-19T00:26:33.333

Reputation: 1

1How does that answer the question? Be more specific. – user 99572 is fine – 2013-08-02T07:45:02.380