0

Currently, I have commands to start the SSH agent in my .bashrc file. The trouble is that this only works in a particular terminal - each time I open a terminal, I'm asked for my private key's passphrase.

Is there a way to open the SSH agent so that it can be used for multiple terminals without having to re-enter the passphrase each time?

1 Answer 1

0

The agent to use is determined by SSH_AUTH_SOCK environment variable (and the agent process itself - by SSH_AGENT_PID), so you can save those to files in your startup scripts (execute ssh-agent in them as intended user) and pass to login shells in .bashrc script. This will give you not system-wide, but user-wide agent. Also if you use X on this machine, you can add ssh-agent to the terminal which starts X, the variables will be inherited by shells called from X. Your question doesn't specify enough details of your environment to be more specific.

3
  • And user-wide is a lot better than system-wide for running an SSH-agent. Having one running system-wide would (probably) mean that all users could use all added keys. Jul 25, 2022 at 18:09
  • The ability to use added keys depends on the socket permissions, and those can be set to allow access for everyone to get said "system-wide" agent, but that defeats the whole purpose of user authentication, although the very usage of an authentication agent means that the user accepts the risk of malicious software being able to impersonate them for the hosts listed in ssh config and probably other ones.
    – Main Furr
    Jul 25, 2022 at 18:35
  • This answer gave me enough information to find this post, which is basically what I wanted to do. Thanks! Jul 25, 2022 at 18:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .