Macfuse sshfs over autofs on OS X

If you are regularly mounting a sshfs volume on your Mac, you can automate this by using autofs. The goal is to mount the filesystem transparently.

Update: This how-to does not work. But you could use these notes as a starting point to resolve the remaining issues. The automounting feature is not correctly implemented in the current Macfuse&sshfs stack.
Luckily, it is possible to get a similar behavior by mounting sshfs with the option “reconnect”.

This howto has been tested with Mac OS X 10.5.5, Macfuse 1.7, sshfs 1.0.0.

Assuming you have installed the latest Macfuse and sshfs, there should reside the in /Applications.

Install mount_sshfs:

sudo ln /Applications/ /sbin/mount_sshfs
sudo ln /Applications/ /usr/local/lib/

Create /etc/fstab if not already existing. Append this line, replacing “user”, “server”, “volname”:

user@server: /Network/volname sshfs compression=yes,reconnect,volname=volname,uid=501,gid=0,allow_other,nobrowse 0 0

Login as root, generate keys (accepting the standard options), and add the keys to enable a passwordless remote login. Replace “user”, “server”.

sudo -s -u root
cat /var/root/.ssh/ | ssh user@server 'mkdir .ssh && cat >> .ssh/authorized_keys'

Now you can reload the autofs configuration, and you should then see your mounted filesystem in Finder’s Network or on /Network/volname.

sudo automount -cv

Good luck, and have fun!

— on 03 October 2008 • permalinkcomments