Skip to content

Instantly share code, notes, and snippets.

@oliora
Last active May 5, 2022 18:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oliora/5e9d2b62e75205773bd70433c4f1e569 to your computer and use it in GitHub Desktop.
Save oliora/5e9d2b62e75205773bd70433c4f1e569 to your computer and use it in GitHub Desktop.
tmux and ssh agent
# Add this to ~/.bashrc or ~/.zshrc or whatever shell you use
if [ -e $HOME/.ssh/ssh_auth_sock ]; then
export SSH_AUTH_SOCK=$HOME/.ssh/ssh_auth_sock
fi
#!/bin/bash
# Fix SSH auth socket location so agent forwarding works with tmux
if ! [ -e ~/.ssh/ssh_auth_sock ]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
# Location:
# ~/.ssh/rc
setw -g xterm-keys on
set -g default-terminal "screen-256color"
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set -g mouse on
new-session -n $HOST
#set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
#setenv -g SSH_AUTH_SOCK $HOME/.ssh/ssh_auth_sock
# Add to ~/.tmux.conf
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment