I am trying to find a good way to recover an SSH agent when reconnecting a disconnected tmux session.
The reason is that the SSH agent session is changing, but the environment variable from the tmux session is not being updated.
How can I automate this before attaching the session itself? Since the session I am attached to does not always have a bash prompt, so I cannot allow myself to type anything inside it. This should be something that needs to be done before creating or joining a tmux session.
Sample code that I run is located at https://gist.github.com/ssbarnea/8646491 , a small ssh wrapper that uses tmux to create a persistent ssh connection. This works pretty well, but sometimes the ssh agent stops working, so I can no longer use it to connect to other hosts.
ssh-agent tmux
sorin Jan 27 '14 at 10:36 2014-01-27 10:36
source share