How is SSH_AUTH_SOCK setup and used by ssh-agent?

user3104542 picture user3104542 · Mar 3, 2014 · Viewed 63.5k times · Source

I have been able to setup the sharing of ssh-agent for public-key authentication after reading https://superuser.com/a/230872/301446

The environment file thus generated has the following contents:

SSH_AUTH_SOCK=/tmp/ssh-OwqeSuxmEsQN/agent.4744; export SSH_AUTH_SOCK;
SSH_AGENT_PID=8960; export SSH_AGENT_PID;
#echo Agent pid 8960;

And agent.4744 has:

!<socket >24194 s 07DF88C6-E9997283-4C471010-2FE57D77

Would you know how this socket is used by ssh-agent? I can understand that it's used by ssh-agent to share authentication information but exactly how?

Answer

user3496230 picture user3496230 · Apr 4, 2014

From here:

$SSH_AUTH_SOCK contains the path of the unix file socket that the agent uses for communication with other processes. This is essential for ssh-add.