Reusing SSH connections

To reduce the number of times it is necessary to enter your credentials, it’s possible to reuse a single SSH connection for multiple terminal instances.


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, subsequent terminals can use that connection, eliminating the need to enter the username and password each time for every connection.  To enable this feature, add the following lines to your ~/.ssh/config file:

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.  

Windows (PuTTY)

To enable connection reuse in PuTTY, enable the “Share SSH connections if possible” option under the “SSH” configuration section.

First, select the saved PuTTY config for the cluster and click “Load”.

Next, select the “SSH” configuration category. Then check the “Share SSH connections if possible” checkbox.

Return to the sessions screen by selecting “Session” at the top and click “Save” to save the settings for future sessions.