Tuesday, 12 August 2008

sshfs using ssh-agent on OSX

The FUSE based sshfs app is pretty nice - but it's even slicker if it imports your ssh-agent keys automatically (as mentioned here) - then it just connects automatically if you're logged into your agent. To do this you need to set up your ssh-agent and the setup sshfs: basically you open the sshfs package and rename the "Contents/Resources/sshfs-static" to "Contents/MacOS/sshfs-static.bin". (Doing the same for sshfs-static-10.5). Then create a new file called sshfs-static (and with sshfs-static-10.5) with the following content:
SSH_AUTH_SOCK=/Users/your-username/.ssh/ssh-agent.pipe $0.bin $*

Now make sure you've installed and set up the ssh-agent according to my instructions then you can start sshfs. Then add a machine you've got a key installed on and it will automatically connect.

[updated] Otherwise now in Leopard ssh-agent works properly and you don't need to follow my instructions - you can use the one here - use this in your sshfs-static:
SSH_AUTH_SOCK=`launchctl getenv SSH_AUTH_SOCK` \
$0.real "$1" "$2" "$3" "$4" "$5" "$6"

No comments:

Post a Comment