In Praise of SSHFS

Emacs is the only editor I can use effectively at this point. It doesn’t matter if there are better choices (there aren’t ;-), it’s the one I’ve invested all of my muscle memory into. When working on files locally, I use normal emacs, and things are grand. Life, however, dictates that a great deal of my coding is done on remote machines. I had tried a variety of solutions to edit remote files (emacs in a shell, emacs of x, samba, nfs, etc…), none working terribly well for me.

Enter sshfs. I’m not entirely sure when sshfs crossed the divide between merely ok to solid, but it’s been more than a year that I’ve been using it happily. sshfs lets you mount a filesystem from any remote machine you can ssh into using FUSE. So when I’m at home, I can do

sshfs office2:work/mongo localworkmongo
to (and this will be intuitive for users of scp and mount) mount the ~/work/mongo directory on office2 onto the localmongo directory on my Mac. Then I can edit files in localworkmongo normally, and I just ssh into the work machine for compilation and execution.

This has been a life changer for me. It has made using a Mac desktop as my only workstation feasible, since most of my development is on a linux desktop sitting next to the Mac under my desk. It makes transitioning between work, home, or a different office painless, and even lets me do tricks like mount ec2 volumes just to poke around if I want to do something locally.

The key for me is that security is all ssh. I already use ssh for everything and go through painstaking efforts to make sure that is both secure and easy. So having to do no additional work to mount things is magic. And just to be clear, the target machine needs no additional software. If I can ssh into it, I can mount files on it.

Also, note that this solution isn’t about using a Mac everywhere, it’s about getting to use your favorite desktop apps to edit your work files no matter where they are… this solution applies just as well to editing Photoshop files mounted on a remote server.

sshfs is in package management on many platforms, including Homebrew for the Mac. As it says in the caveats, make sure you understand the info regarding the FUSE kernel extension before trying to use it.