I use ssh-agent with password-protected keys on Linux. Every time I log into a certain machine, I do this:
eval `ssh-agent` && ssh-add
This works well enough, but every time I log in and do this, I create another ssh-agent. Once in a while, I will do a killall ssh-agent
to reap them. Is there a simple way to reuse the same ssh-agent process across different sessions?
Agent forwarding comes with a risk When you forward ssh-agent 's Unix domain socket to a remote host, it creates a security risk: anyone with root access on the remote host can discreetly access your local SSH agent through the socket. They can use your keys to impersonate you on other machines on the network.
ssh directory exists. That you only want one ssh-agent socket per user on the system. That the HOME environment variable is set (because why wouldn't it, right?). That you will manually handle a situation where there is a process running, but it for some reason doesn't use the socket file designated.
Use ssh-add to add the keys to the list maintained by ssh-agent. After you add a private key password to ssh-agent, you do not need to enter it each time you connect to a remote host with your public key.
On most Linux systems, ssh-agent is automatically configured and run at login, and no additional actions are required to use it. However, an SSH key must still be created for the user. The ssh-agent command outputs commands to set certain environment variables in the shell.
have a look at Keychain. It was written b people in a similar situation to yourself. Keychain
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With