Worth mentioning the package 'keychain', which manages ssh-agent and eliminates 99.99% of all the garp in jojpi's reply.In my .bashrc I have:privkey1 and privkey2 are private keys in my ~/.ssh directory. You can add more keys to the list if desired.
Each time I login, I simply typeand I'm good to go. Obviously, you could wire up keystart to run in your .bashrc, I prefer to do it manually, and I don't have to do it very often.
When using keychain I only need to type the passphrase for my SSH key once per boot, unless I did a 'keystop'.
Code:
sudo apt install keychainCode:
alias keystart='keychain -q --nogui --ignore-missing --agents ssh privkey1 privkey2 ; source ~/.keychain/$(hostname)-sh'alias keystop='keychain -q --stop all'Each time I login, I simply type
Code:
keystartWhen using keychain I only need to type the passphrase for my SSH key once per boot, unless I did a 'keystop'.
Code:
bls@pw~> keystartEnter passphrase for /home/bls/.ssh/idbls: bls@pw~> ssh-agentSSH_AUTH_SOCK=/tmp/ssh-l9avfCbXmDSz/agent.533697; export SSH_AUTH_SOCK;SSH_AGENT_PID=533698; export SSH_AGENT_PID;echo Agent pid 533698;bls@pw~> keystopbls@pw~> keystartEnter passphrase for /home/bls/.ssh/idbls: bls@pw~> Statistics: Posted by bls — Wed Feb 11, 2026 12:21 am