Macfuse sshfs over autofs on macOS 03 October 2008
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.
Note: This how-to does not work anymore, mainly because the automounting feature is not correctly implemented in the current Macfuse&sshfs stack. But you could use these notes as a starting point to resolve the remaining issues.
There is a more current howto you may follow. Furthermore, a similar behavior is obtained by mounting sshfs with the option “reconnect”.
The following howto is tested with Mac OS X 10.5.5, Macfuse 1.7, and sshfs 1.0.0. Assuming you have installed the latest Macfuse and sshfs, there the sshfs.app resides in /Applications. Then, install mount_sshfs:
cd /Applications/sshfs.app/Contents/Resources sudo ln sshfs-static-10.5 /sbin/mount_sshfs sudo ln sshnodelay.so /usr/local/lib/
Create /etc/fstab if is 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 SSL keys (accepting, e.g., the standard options), and add the keys to enable a passwordless remote login. Replace “user”, “server”.
sudo -s -u root ssh-keygen cat /var/root/.ssh/id_rsa.pub \ | ssh user@server 'mkdir -p .ssh && cat >> .ssh/authorized_keys'
Now you may reload the autofs configuration. Then, you should see your mounted filesystem in Finder’s Network or on /Network/volname.
sudo automount -cv
Good luck, and have fun!