Skip to content

Instantly share code, notes, and snippets.

@artyom
Created August 16, 2012 08:24
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save artyom/3368367 to your computer and use it in GitHub Desktop.
Save artyom/3368367 to your computer and use it in GitHub Desktop.
Persistent SSH_AUTH_SOCK for using with screen/tmux
# put this to your $HOME/.bashrc
# so you can safely use screen or tmux while preserving ssh-agent forwarding features
# of your ssh sessions
test "${SSH_AUTH_SOCK:-}" && test $SSH_AUTH_SOCK != $HOME/.ssh_auth_sock && {
test -L $HOME/.ssh_auth_sock && \
test "$(readlink $HOME/.ssh_auth_sock)" = $SSH_AUTH_SOCK || \
ln -sf $SSH_AUTH_SOCK $HOME/.ssh_auth_sock
export SSH_AUTH_SOCK=$HOME/.ssh_auth_sock
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment