My situation:
- There are several servers on my LAN which I do not administer
- I access them using SSH for sshfs, shells, and remote X11 apps
- I have set
ControlMaster auto
in my~/.ssh/config
file so I don't experience authentication lag - I use Compression and fast/weak Ciphers since I'm either on a private LAN or using VPN
- Wherever possible, I have exported my (passwordless) public RSA key to the servers
I've started using autofs to make my life easier, but autofs wants to run all of its mount commands as root. I can, of course, generate a new RSA keypair as root and export that, and also replicate my own ~/.ssh/config
options to the superuser's config file, but I'd rather not maintain two copies of these things, and it doesn't solve my desire to have only one open SSH connection to each host. Therefore, I want to have autofs run sshfs
as an unprivileged user, just like it does when manually invoked at the terminal.
I've looked into autofs scripts, but those don't appear to be a solution to my problem. Any suggestions?
Best Answer
JFTR, I've modified (and simplified)
ssh_user
so that it first tries to contact the user'sssh-agent
: