I have a bash session on tty2 and an ssh-agent
process belonging to me (same user id) from a previous session (TTY = ?)
On tty2, ssh-add
says :
Could not open a connection to your authentication agent.
Do I have to start an eval $(ssh-agent)
each time I log in, even when there's already an ssh-agent
process running ?
But then at the end, I will have many ssh-agent
process instances running :-(
EDIT : I would like to use my already running ssh-agent
process.
I found a way to contact my already running ssh-agent
like this :
export SSH_AUTH_SOCK=$(find /tmp/ssh-*/ -user $USER -type s -name "agent.*" 2>/dev/null | head -1)
export SSH_AGENT_PID=$(echo $SSH_AUTH_SOCK | cut -d. -f2)
but I'm not sure this is very secure.
EDIT 2: The command eval $(ssh-agent)
starts a new instance of the ssh-agent
process every time I run this command :-(
The agent will never send a private key over its request channel. Instead, operations that require a private key will be performed by the agent, and the result will be returned to the requester.
– Ortomala Lokni Mar 30 '18 at 16:16use
instead ofstill
:) – SebMa Mar 30 '18 at 17:58export
commands (see my question) to load my ssh key into the agent without the need of unlocking them because the agent is killed when a user logs out. – SebMa Apr 23 '18 at 10:00