# Configuration to use remote tmux over ssh in iterm This is a compilation of information I found in different postings on the net. ## All manual invocation ### Basic remote tmux session `tmux` can be invoked in command mode using `tmux -CC`. The simplest way to get a remote tmux session into a window of iterm is to invoke it on the remote host ``` local> ssh tmhost #... remote> tmux -CC ``` This will open a new tmux session in a new iterm window. ### Invoke tmux as the command to ssh To run `tmux` as the remote command argument to `ssh`, it need a pseudo-terminal attached. This means invoking `ssh` with the `-t` flag: ``` local> ssh tmhost -t tmux -CC ``` ### Naming the remote session to be able to re-attach If you want to re-attach to a remote session, you have to know its name. The easisest way to is to create a session with a well known name and re-attach to that session later. For that, we invoke `tmux` with the command `new -A -s tmux-main`. The session name is set using the `-s` flag, the `-A` flag specifies that `new` behaves like `attach` if the session exists. The command is now ``` local> ssh tmhost -t tmux -CC new -A -s tmux-main ``` ## Setting up a host configuration ## Automatic ssh-agent socket handling and renewal