Use keychain
, a simple ssh-agent
wrapper, to handle this for you.
Add to your ~/.bashrc
:
eval $(keychain --clear --eval id_rsa id_dsa id_ecdsa other.id_rsa )
This way you only need to type your passphrases once upon login. You can still manually add and list keys directly using the agent as usual:
$ ssh-add -l 4096 10:93:fe:6c:2b:36:xx:be:78:xx:bd:xx:b7:f9:0f:46 /home/user/.ssh/id_rsa (RSA) 1024 86:dc:ed:e0:c8:f4:99:bc:99:ee:55:xx:ac:51:e6:cb /home/user/.ssh/id_dsa (DSA) 521 28:xx:f4:d6:10:xx:40:4b:cd:xx:ef:e2:fc:8f:0b:xx /home/user/.ssh/id_ecdsa (ECDSA) 4096 5d:5a:xx:41:xx:2e:ab:ae:xx:ff:5c:47:xx:3a:cf:xx /home/user/.ssh/other.id_rsa (RSA)
The --eval
argument in keychain(1)
accepts full paths, so you can have your keys wherever you want to.