SSH_AUTH_SOCK=/tmp/ssh-WEk27297/agent.27297; export SSH_AUTH_SOCK; SSH_AGENT_PID=27298; export SSH_AGENT_PID; echo Agent pid 27298;
This means that if you need to set the ssh-agent
PID and SOCK environment settings by hand, you will need to know
- the filename of the socket within the file system
- the process ID of the
ssh-agent
process
#!/bin/bash $pid=$1 $HashVal=$2 export "SSH_AUTH_SOCK=/tmp/ssh-$HashVal/agent.$pid" export "SSH_AGENT_PID=$pid" echo "SSH_AGENT_PID: $SSH_AGENT_PID" echo "SSH_AUTH_SOCK: $SSH_AGENT_PID"
Note that the value passed in as the 2nd parameter - the value assigned to $HashValue
- is created by the ssh-agent
on startup.