To set up autofs with sshfs so that it works with your ssh-agent, you need to set your ssh-agent to use a pre-defined path, and then tell autofs about it.
file.exists() { test -e "$1" ; } export SSH_AUTH_SOCK="${HOME}/.ssh/agent" ssh_agent_check() { ssh_agent=$(ssh-add -l 2>&1) no_identities="The agent has no identities." no_agent="Could not open a connection to your authentication agent." [[ "${ssh_agent}" = "$no_agent" ]] && { file.exists ${SSH_AUTH_SOCK} && { killall -9 ssh-agent 2>/dev/null command rm ${SSH_AUTH_SOCK} 2>/dev/null } ssh-agent -a ${SSH_AUTH_SOCK} >/dev/null } ssh_agent=$(ssh-add -l 2>&1) [[ "${ssh_agent}" = "${no_identities}" ]] && { ssh-add } } ssh() { ssh_agent_check; command ssh "$@"; } scp() { ssh_agent_check; command scp "$@"; }
export SSH_AUTH_SOCK="${HOME}/.ssh/agent"
/$MNT /etc/autofs/auto.sshfs uid=$UID,gid=$GID,--timeout=30
haller.ws -fstype=fuse,rw,allow_other,IdentityFile=/home/$USER/.ssh/id_dsa,Port=22 :sshfs\#$USER@$HOST\:/
That's it. $( /etc/rc.d/autofs restart ) and you should should be good to go. Otherwise, add verbose to your /etc/conf.d/autofs daemonoptions. ;)
You might be able to get away with running autofs from one's xinitrc, so that would inherit the SSH_AUTH_SOCK and you might not need to use a predefined SSH_AUTH_SOCK.