My contribution to XKCD’s #949

Randall Munroe rightly put shame on all the geeks in the world when he pointed out that transferring files over the internet is still an unsolved problem.

I am a big fan of FileTea’s approach to transferring files, where they are streamed from browser to browser, without registration and without being stored on some central server, and where closing the browser tab reliably cleans up the transfer. But I wanted something that works from the command line, so I created a small tool called share-file that will use SSH port forwarding to serve the files from a local, embedded web server at a publicly available port, as shown in these screenshots:

It works without additional dependencies (but better with python-magic installed) and requires a publicly available SSH server configured with GatewayPorts clientspecified. For more details, see the README, and to try it out, simply fetch it with git clone git://git.nomeata.de/share-file.git.

BTW, if someone implements a command line client for FileTea, I’ll happily dump share-file for it.


Sending files over Jabber/XMPP is simple enough :p
#1 Jan (Homepage) am 2013-12-19T14:43:15+00:00
Yes, and it would be great if everyone would use Jabber. (And does it really work even in difficult NAT situations? I only used it rarely so far...)
#2 Joachim Breitner (Homepage) am 2013-12-19T14:52:38+00:00
python -m SimpleHTTPServer ?
#3 xu am 2013-12-19T15:26:15+00:00
I’m basically doing that, only that the webserver is available on a different host. Usually, my laptop is not publicly available, so python -m SimpleHTTPServer alone will not help.
#4 Joachim Breitner (Homepage) am 2013-12-19T15:30:08+00:00
I did not know about filetea. I am the author of Fipes [1] a web application that seems to solve the problem in the exact same way.

I think there is no technical difficulties to solve the 949 problem (however we can argue on the definition of "fixing" here).
We need to make people more aware of the fact that free software solutions exist.

Anyway, congrats for this simple solution, using ssh here is quite clever :)

[1] https://github.com/tOkeshu/fipes/
#5 tOkeshu (Homepage) am 2013-12-19T15:56:03+00:00
Got a simple one you can try at

#6 Jason am 2013-12-19T19:26:08+00:00
If I had found that before I wouldn’t have created share-file... thx for it!
#7 Joachim Breitner (Homepage) am 2013-12-19T23:02:31+00:00
It only existed after I read the post on HN this morning. It was a fun challenge, and I'm glad you can put it to some use.
#8 Jason am 2013-12-20T03:48:19+00:00
btsync has pretty much solved it.
#9 technimad am 2013-12-19T20:42:23+00:00
I had a similar idea for Emails, but never got around to actually implement it. I thought it would be a good idea to strip of binary attachments, put them on a webserver and replace them with a link to the file. To avoid potential security risks, the link to the file should be a shaXXX sum. Of course, if someone wanted real security, they should encrypt their files.
I think your solution is a step to that direction. It could probably be easily used as a postfix filter.
How do you generate your links (the AYLD.. part?)
#10 jrk am 2014-01-10T11:53:42+00:00
I think e-mail attachments are a bit different. For example, when do you know when you can stop serving the file?

I use

''.join(random.choice(string.ascii_uppercase + string.digits) for x in range(8))

to generate the random string.
#11 Joachim Breitner (Homepage) am 2014-01-10T12:00:48+00:00
Oh my, I completely forgot about this, sorry.
Several solutions for obsolete files come to my mind.

- Provide the sender with a deletion link
- Provide the receiver with a deletion link
- Provide both, sender & receiver, with a deletion link; do reference counting for multiple deletion links
- Automatically delete the file after X amount of time
- If the email is kept on the same server (e.g. by imap) keep a database of email/file references and delete the file when the email is deleted

Would be fun to implement something like this, if I had the time. :)
#12 jrk am 2014-05-26T18:11:48+00:00

Have something to say? You can post a comment by sending an e-Mail to me at <mail@joachim-breitner.de>, and I will include it here.