I’ve written before about the extreme usefulness of sshfs for accessing files remotely without having to install server software. It continues to be an important part of my toolbox, as does its cousin CurlFtpFS which – unlike sshfs – I can even use to mount a directory here on my web host. Of course, either becomes even more useful when combined with some easy method of synchronization. You probably have rsync already. You can also use Unison if you need bidirectional synchronization – which you generally will if you’re trying to use a single directory somewhere as a “drop box” to share between multiple machines.

I just found another sshfs trick today. If the connection between your two machines is already secure – e.g. on the same private network or connected via a secure VPN/tunnel – you might want to avoid an extra round of encryption and decryption by using the “-o directport” option to sshfs. This causes sshfs to bypass all of the ssh stuff and just create a simple TCP connection . . . but what should you run at the other end? Here’s where socat (another extra-useful tool) comes in handy. On the server end (assuming a pretty standard Linux setup), you can just run this:

socat TCP4-LISTEN:7777 EXEC:/usr/lib/sftp-server

Then, on the client:

sshfs -o directport=7777 remote:/dir /local/dir

Now you have a completely insecure TCP between the two machines, so you’d really better not do this directly over the internet without some other way of securing things at a lower level. It’s still pretty handy, though, and I couldn’t find a mention anywhere else of how to do it so there it is.