Skip to content

Instantly share code, notes, and snippets.

@jimblue
Forked from lukasnellen/00-ssh-tmux-iterm.md
Created March 20, 2021 23:43
Show Gist options
  • Select an option

  • Save jimblue/202d9434bc0bc55d34da626ba674452e to your computer and use it in GitHub Desktop.

Select an option

Save jimblue/202d9434bc0bc55d34da626ba674452e to your computer and use it in GitHub Desktop.
Summary of my remote tmux and ssh configuration to benefit from the iterm2-tmux integration, with ssh authentication socket refreshing

Configuration to use remote tmux over ssh in iterm

# This is a fragment of ~/.ssh/config (local)
Host tmux
HostName remote.host.some.where
ForwardAgent yes
RemoteCommand tmux -CC new -A -s tmux-main
RequestTTY yes
#! /bin/bash
# This is ~/.ssh/rc (remote)
if [ ! -S $HOME/.ssh/ssh_auth_sock -a -S "$SSH_AUTH_SOCK" ]; then
ln -sf $SSH_AUTH_SOCK ~/.ssh/ssh_auth_sock
fi
# This is ~/.tmux.conf (remote)
set -g update-environment "DISPLAY SSH_ASKPASS SSH_AGENT_PID SSH_CONNECTION WINDOWID XAUTHORITY"
set-environment -g 'SSH_AUTH_SOCK' $HOME/.ssh/ssh_auth_sock
set -g set-titles on
# not all distros have a tmux terminal type
#set -g default-terminal tmux
set -g default-terminal xterm-color
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment