Versions Compared


  • This line was added.
  • This line was removed.
  • Formatting was changed.

To make it more convenient for users who use multiple terminal sessions simultaneously, SSH can reuse an existing connection if connecting from Linux or Mac.  After the initial login, additional subsequent terminals can use that connection, eliminating the need to enter the username and password each time for every additional terminalconnection.  To enable this feature, add the following lines to your ~/.ssh/config file:

Code Block
Host *
ControlMaster auto
ControlPath /tmp/%r@%h:%p
ControlPersist 2h

You may not have an existing ~/.ssh/config. If not, simply create the file and set the permissions appropriately first: touch ~/.ssh/config && chmod 600 ~/.ssh/config

This will enable connection reuse when connecting to any host via SSH or SCP.  


Please note that if you terminate the original session, all other sessions using the connection will be terminated as well.