Sshfs automount with password-enabled ssh key and ssh-agent in ubuntu

automountsshssh-agentsshfs

I currently set up sshfs automount on ubuntu per this thread. It's nice because of the network up and down scripts. The benefit comes at a cost: it requires passwordless ssh via an ssh key. I was wondering if anyone had any advice on how to incorporate ssh-agent with this process so that I can use a passworded key for more security. With ssh-agent, I would only have to enter my password once in each session, even for mounting multiple ssh servers as ssh-agent would give the key.

Any help is much appreciated.

Best Answer

It's pretty straightforward -- you just start the agent somewhere out of the way, feed it the key(s) of interest, then set the SSH_AUTH_SOCK environment variable in the environment of the sshfs process to point to the agent.