Difference between revisions of "Sharing multiple ssh connections"

From Notes_Wiki
m
m
Line 1: Line 1:
<yambe:breadcrumb>OpenSSH server configuration|OpenSSH</yambe:breadcrumb>
<yambe:breadcrumb>OpenSSH server configuration|OpenSSH</yambe:breadcrumb>
=Sharing multiple ssh connections=
=Sharing multiple ssh connections=
'''There is newer article on this at [[CentOS 8.x SSH client tips and tricks]]'''


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 '<tt>/etc/ssh/ssh_config</tt>' file:
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 '<tt>/etc/ssh/ssh_config</tt>' file:

Revision as of 01:28, 13 April 2021

<yambe:breadcrumb>OpenSSH server configuration|OpenSSH</yambe:breadcrumb>

Sharing multiple ssh connections

There is newer article on this at CentOS 8.x SSH client tips and tricks

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.