I know a lot of web developers still use FTP clients to work on remote servers. I prefer to have a local dev install and use scp, rsync and git to push changes whenever it’s feasible. When I can’t do that, though, I use
sshfs (SSH Filesystem) allows me to mount a remote server over SSH on my local filesystem, very similar to the way ExpanDrive does it (using FUSE). In addition to web design work, this can be great for system administration and other applications where you have to work on a remote server where you don’t a full dev environment set up. You get to use your own tools on your local machine while working directly with the files on the remote, all with the security of SSH.
If this sounds interesting, here’s the easiest way to get started. Install homebrew (if you haven’t already), then use it to install
brew install fuse4x sshfs
There’s also a new project called Fuse for OS X that is supplanting Fuse4X, but the above combination is perfectly stable for now and is — to the best of my knowledge — the path of least resistance for getting
sshfsup and running quickly.
Make a folder called “mounts” in your home folder (or whatever/wherever you want to mount the filesystems, but you’ll need to modify the following scripts). Add
rumount below to your
~/.bash_profile to be able to quickly mount and unmount remote directories locally:
These functions work with any host set up in
~/.ssh/config (key pair access preferred, especially for scripting mounts). Say you have a section in your
host mm HostName cookie.macminicolo.net User monster
and you have a key pair set up for password-less entry. Now you can just type
rmount mm to mount the entire filesystem in
~/mounts/mm (the script will auto-generate the folder name based on the host or directory name). Typing
rmount mm:/Users/monster would mount only the Home folder of a co-located Mac mini in
rumount monster un-mounts the remote folder and removes the local mount point.
Why do this? Because, now you get all of the benefits of working on your own system. It’s as secure as SSH/SFTP but with access to your local environment and applications, and there’s no need to download each file you want to work on and wait for it to sync back up. Yes, it’s a bit slower (a bit determined by bandwidth, of course) than your local filesystem, but the direct tunnel keeps things moving nicely1.
Some of the things I love about
sshfs vs. SSH or an FTP client:
rmateor local listener required)
qlmanage -p(Quick Look from the command line)
- quick file copy/move between filesystems (no
rsyncor reverse tunneling needed)
- Finder access, because…
There, did I sell you2?
By the way, ExpanDrive for Mac just updated for the first time in quite a while. If you want all of this goodness in a GUI instead of the Terminal, check it out. Happy
Please note that I will not be compensated in any way if you start using
sshfs. I don’t think anyone will. I am not invested in your future, I just want the best for you. Because you’re special. Stop it.↩