For those that use
screena common problem is to "lose" your
ssh-agentafter ending an
sshto a remote server and start
screenfor the first time.
What happens is
screenstarts and all your shells in
screencapture the value of
SSH_AUTH_SOCKat that time. You can access your agent because the value of the environment variable in each shell is current.
2. Detach from
screenand exit from your
screenis still running on the remote server (along with all your shells).
sshto the remote server and reattach to the running
So now you've reattached, but the environment variable
SSH_AUTH_SOCKin each of your running shells is out of date. As a result you can't access your
ssh-agentfrom your shells unless you update
- Open up the shell config file you store your aliases in. ie. vim ~/.bashrc
- Add an alias for screen that will transparently update the auth-sock location to the same location every time.
alias screen='ln -sf $SSH_AUTH_SOCK $HOME/.ssh-auth-sock; env SSH_AUTH_SOCK=$HOME/.ssh-auth-sock screen'