Speeding up multiple SSH connections to the same host

If you have multiple ssh connections to the same host, you can speed up the process a bit by letting the first ssh connection you make to the server act as master-connection, which mean that every other ssh connection you make to that server afterwards will be transferred inside the first ssh connection.

It's quite easy to make that work, just add the following to your ssh config file located at ~/.ssh/config:

Host *
  ControlMaster auto
  ControlPath ~/.ssh/master-%r@%h:%p

Note that this will only work if the server uses ssh version 4 or newer.

If you need to connect to a server using an older version of ssh, add this to your ssh config file (obviously you need to change very-old-server.com to the correct domain name or IP address):

Host very-old-server.com
  ControlMaster no

And you should be set. Enjoy.

Written by Jannich Brendle ons 04 februar 2009 In How to

tags: securityssh

Related posts