21/06/2008
Speed up multiple ssh connections to the same destination
When you are doing multiple ssh connections to one host there’s a way to speed them up by multiplexing them. When you open the first network connection a special socket is created and then all other connections to the destination machine pass through the first network connection and don’t open any new ones. All that is done via ControlMaster and ControlPath settings for ssh_config.
Example usage:
Inside /etc/ssh/ssh_config
ControlMaster auto
ControlPath /tmp/%r@%h:%p
Firsh ssh connection:
% ssh foobar@foo.bar.gr
Password:
Linux foo.bar.gr 2.6.20.1-1-686 #1 SMP Sun Mar 4 12:44:55 UTC 2007 i686 GNU/Linux
foobar@foo:~$
Second ssh connection:
% ssh -p 22 foobar@foo.bar.gr
Linux foo.bar.gr 2.6.20.1-1-686 #1 SMP Sun Mar 4 12:44:55 UTC 2007 i686 GNU/Linux
foobar@foo:~$
No password is asked and the connection opens up immediately.
kudos to apoikos for telling me about this neat feature in fosscomm 🙂
Filed by kargig at 11:50 under Encryption,Internet,Linux,Networking,Privacy
6 Comments | 5,780 views
http://www.revsys.com/writings/quicktips/ssh-faster-connections.html
It would be weird if nobody else had written about it 🙂
A search for http://www.google.gr/search?q=ssh+controlmaster reveals a lot more articles about it…
Why not just use agent?
Very very usefull. Thank you 🙂
@sam: ssh-agent needs public keys. This method doesn’t. And they don’t quite do the same thing. I use ssh-agent daily, but I don’t use public keys in all of the machines I administer.
Excellent tip! thnx!