There’s a handy tool for Mac users that I rarely see getting use, the SSHFS filesystem. SSHFS is a FUSE filesystem uses the SSH File Transfer Protocol (SFTP) as it’s backend. The short of it is that you can mount a remote directory on your local machine with nothing more than SSH access.
FUSE is the Filesystem in Userspace, a operating system extension that allows non-root users to create mountable filesystems. FUSE is available for most UNIX-like operating systems, including OS X.
The first step to using SSHFS is to install FUSE for OS X (There’s a prior version called MacFUSE, you don’t want that). Once installed, reboot your Mac.
By itself, FUSE for OS X doesn’t do much, it provides the layer for userspace filesystems, but no filesystems itself, so download (found on the FfOSX page) and install SSHFS as well.
Now that you have SSHFS installed, you can create a local SFTP backed
volume with the
First you need a directory that you can mount the filesystem on:
The first option is the remote path, it can contain a username as well
email@example.com:/var/www. Because SSHFS uses SSH under the
~/.ssh/config settings are honored. Whatever
*something* does will apply to
sshfs *something*:path. You can
also leave of the path to the remote home directory i.e
When you are done, you can unmount the filesystem with:
Or ejected it in the Finder.
-o defer_permissions is important! The default behavior is use the
normal system of checking UIDs for file access. Unless you have the same UID
on both your Mac and the remote system, this is probably not going to
work. defer_permissions let’s the remote system handle permission
checks, if you can access a file on the server, you will be to access
it locally. If you’re the kind of person who make sure that your UIDs
are the same everywhere, then you need help, but you don’t need
-o volname=Server sets the name that the volume will have in the
Finder. Otherwise it’s called something like OSXFUSE Volume 0 (sshfs)
Where you mount it matters as that’s where the drive icon will appear. In the above example, I create the local mount point in the Desktop folder, which makes the drive appear on the Desktop when mounted. The downside of that, is then when the drive is not mounted, you have an empty folder that appear on the Desktop.
Another popular approach is to mount it in /Volumes, where OS X traditionally mounts drives.
The OS will automatically remove the directory when you unmount, you’ll need to create it each time, but you won’t need to clean it up.
Wherever you mount it, the drive icon will always appear in the Finder under Devices -> Your Computer. And, of course, if you’re using command line, the drive icon is pretty much a non-issue.
Sharing with Others
By default, the file system is only visible to the person that mounted
it. To allow other users to see it you can add
-o allow_other to the
command line. This can be a little dangerous when combined with
defer_permissions as everyone will have the permissions of the
account that was used for the SSH connection. Use this option with care.
As I’ve previously written, my perfered workflow for uploading to servers is to use a combination of Make/Rake and rsync. What I really like SSHFS for is browsing. Using the Finder I can open a folder and use the Quick Look feature to, say, search through a directory of images.
However, you can just as easily read and write files on the server through SSHFS, allowing you to apply your favor desktop tools to the remote files.
There are wide variety of filesystems for FUSE, but unfortunately, most of them have not been ported to OS X. My favorite, conceptually anyway, I haven’t used it, is PNGDrive, a file system that automatically hides data in PNG files using Steganography
In terms of file systems that actually work under OS X, there’s a list here:
The most useful are probably: