Sharing multiple ssh connections

From Notes_Wiki
Revision as of 10:28, 7 November 2012 by Saurabh (talk | contribs) (Created page with "=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. connect...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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.