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 :-(