From Notes Wiki
Jump to: navigation, search
Home > CentOS > CentOS 6.x > OpenSSH > Sharing multiple ssh connections

Sharing multiple ssh connections

It is possible that once ssh connection is established with the machine, the same gets used for all additional ssh, scp, rsync etc. connections to remote machine without requiring user to enter password again. For this we need to configure ssh client by adding following configuration in '/etc/ssh/ssh_config' file:

Host *
        ControlMaster auto 
        ControlPath /tmp/%r@%h:%p

Note that sharing connections is property of SSH client and not SSH server.

ControlMaster also takes other parameters like yes, no apart from auto. But if we use yes or not we need to explicitly specify whether this is first connection (Master connection) or slave connection which is not convenient. Hence using auto saves us from having to specify yes or not appropriately for each connection.