Skip to content

Instantly share code, notes, and snippets.

@bergman
Created October 6, 2014 08:56
Show Gist options
  • Save bergman/15ea3ff301c1f716b85b to your computer and use it in GitHub Desktop.
Save bergman/15ea3ff301c1f716b85b to your computer and use it in GitHub Desktop.
tmux ssh-agent forwarding
# this file goes in ~/.ssh/rc
if [ -S "$SSH_AUTH_SOCK" ]; then
# This gets executed by sshd on every client login, symlinking the forwarded
# agent socket into a predictable location to be picked up by tmux.
ln -sf "$SSH_AUTH_SOCK" "$HOME/.ssh/ssh_auth_sock"
fi
# disable auto updating of things like SSH_AUTH_SOCK
set -g update-environment ""
if-shell '[ -h ~/.ssh/ssh_auth_sock ]' "set-environment -g 'SSH_AUTH_SOCK' ~/.ssh/ssh_auth_sock"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment