Is there a way to open a new Terminal in an existing SSH session? I am logged into a remote system and have a special session that I have to request and wait to receive. I know I can then use the "xterm &" command to open multiple xterm windows within that session, but xterm behaves differently from OSX's built-in Terminal. Is there a way to open multiple Terminal windows within the existing SSH session?

  • 1
    tmux is available through homebrew haven't used it myself tho... tmux.github.io
    – AllInOne
    Commented Jan 4, 2017 at 20:05

1 Answer 1


Yes, you can reuse exiting ssh connection and open ssh in whatever terminal you like. See this answer to a StackOverflow question for details:

If you open the first connection with -M:


subsequent connections to $REMOTEHOST will "piggyback" on the connection established by the master ssh. Most noticeably, further authentication is not required. See man ssh_config under "ControlMaster" for more details. Use -S to specify the path to the shared socket; I'm not sure what the default is, because I configure connection sharing using the configuration file instead.

In my .ssh/config file, I have the following lines:

host *
  ControlMaster auto
  ControlPath ~/.ssh/ssh_mux_%h_%p_%r

This way, I don't have to remember to use -M or -S; ssh figures out if a sharable connection already exists for the host/port/username combination and uses that if possible.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .