I am using a variation of the following line:
export SSH_AUTH_SOCK=$(find /tmp/ssh-* -name agent.\* -uid $(id -u)|head -n 1)
found over at Github. This way I should be able to use my forwarded agent connection on the remote system even from inside
tmux. However, what if I establish two separate SSH connections to the remote machine and both of them run a separate instance of the
The question boils down to:
- should I avoid starting another instance of
ssh-agentin the first place?
- if the answer is no on the preceding point, how do I choose to which existing socket to connect, given there are multiple running at the moment?
bonus question: can there be something like a stale socket? I.e. when I look for the socket using theTurns out there can be stale sockets. Just had the issue.
findcommand above, can I end up with two alternatives one of which has gone bad/stale? Or are sockets cleaned up automatically when the process owning them dies?