[Novalug] Speed Up Multiple SSH Connections to the Same Server

American Dave novalug@soupy.org
Sat Jan 3 11:16:52 EST 2009


> Date: Fri, 2 Jan 2009 11:42:42 -0500
> From: "Doug Toppin" <dougtoppin@gmail.com>
> Subject: [Novalug] Speed Up Multiple SSH Connections to the Same
> 	Server
> To: NOVALUG <novalug@calypso.tux.org>
> Message-ID:
> 	<250bc46e0901020842j7d5e8476ocf992badbe9b9b37@mail.gmail.com>
> Content-Type: text/plain; charset=ISO-8859-1
> 
> i tend to do a lot of ssh'ing in different xterms to a few development
> hosts at work and recently ran across the following tidbit that does
> make a visible performance difference to me:
> http://www.linuxjournal.com/content/speed-multiple-ssh-connections-same-server
> 
> just passing it along in case anyone else ssh's up a storm as well.

I'm a big fan of connection sharing.  I use it so much that I've written scripts that will only work if the control path exists.  As noted in the comments in the article, you occassionaly run into issues when you wish to do something like port forwarding *after* you've established a connection.  It's easy to fix this, just create a new connection with a new control path or add "-S none" to your ssh containing port forwarding.

Also the article shows how to automatically enable connection sharing.  To try it manually, without editing ~/.ssh/config try:

ssh -M -S /tmp/test me@somehost.com

Then to re-use the connection, simply type:

ssh -S /tmp/test foo

The second connection will be much faster, and you don't even need a valid hostname, merely the control path, "/tmp/test".  

Again please note that in our example, you can't "add" functionality to the original connection like port forwarding.  You're merely sharing an existing connection.

Enjoy.
-A. Dave



More information about the Novalug mailing list