1 minute read

I needed to edit numerous files today on a remote linux box. Normally, I would ssh in and use vi. However, I had to edit ruby/rhtml files and I wanted a familiar environment (in this case, TextMate).

I briefly looked at mounting the remote filesystem over NFS. However, NFS was not set up and I did not have the permissions to do it myself.

I googled around for a bit and discovered sshfs. This tool let me mount a remote file system with nothing more than ssh access. It is even included in MacPorts.

All I had to do was run:

% sudo port install sshfs

to install it, and then:

% sshfs user@host:/path/to/remote /tmp/remotefs

to mount the remote path under /tmp/remotefs on the local box. Now, I can open TextMate and edit the files as if they were local:

% cd /tmp/remotefs
% mate .

sshfs uses FUSE to set up a filesystem in user space. I do not need root access to mount the filesystem, and once it is mounted, it acts just like any other filesystem.

Here is the entry from running ‘df’:

                       7812500         0   7812500   0% /tmp/remotefs

I can now unmount the drive with (unless it is a mac, for some reason):

% fusermount -u /tmp/remotefs

or the more familiar:

% sudo umount /tmp/remotefs

Note that using fusermount does not require root but using umount does.