Reusing SSH Connections

Reusing SSH Conections
ControlMaster is a new feature in OpenSSH v 4.x, that allows it to reuse an existing connection to a remote host when opening new connections to that host

Using this feature you can increase performance as it result into the reduced connection times that the ControlMaster feature provides are particularly nice when you’re using tools that open multiple SSH connections to do work on a remote server…

    $ man ssh_config

Enables the sharing of multiple sessions over a single network connection. When set to “yes” ssh will listen for connections on a control socket specified using the ControlPath argument.

Specify the path to the control socket used for connection sharing as described in the ControlMaster section above or the string “none” to disable connection sharing. In the path, ‘%h’ will be substituted by the target host name, ‘%p’ the port and ‘%r’ by the remote login username. It is recommended that any ControlPath used for opportunistic connection sharing include all three of these escape sequences

Read man page for more details ( leia a página de manual para maiores informações )

    $ cat .ssh/config

Host *

Compression yes

ControlMaster auto

ControlPath ~/.ssh/%l-%r@%h

ControlPersist yes

Protocol 2

ServerAliveInterval 10

    $ ssh

Close conection and reopen a see with your eyes the diference !

TIP: The line Host can be:

The configuration will apply only to hosts .1 and .2 you can do the follow:

Host 10.1.1.?

This will apply to host between 1 and 9

Follow the video :

This entry was posted in Videos and tagged , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.