Thursday, 26 February 2009

Automatic mounting of SSH filesystems in OS X

Getting your MacFUSE SSH filesystem to mount automatically on login isn't Voodoo, but it is Magick.

Here's how it's done using launchd:

Create a Properties List file under, ~/Library/LaunchAgents:

eg: ~/Library/LaunchAgents/com.example.sshfs.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">

We can now load this into launchd by running,
$ cd ~/Library/LaunchAgents 
$ launchctl load com.example.sshfs.plist

Your SSH filesystem should now be mounted.
$ mount
    . on /path/to/mountpoint (fusefs, nodev, nosuid, synchronous, mounted by user)