Thoughts on System Administration

14 February, 2008

Simple SSH speed-up

Filed under: Quick Tips — Tags: — plathrop @ 4:00 pm

I just discovered something that is very simple but saves a significant amount of time. Specifically, the SSH ControlMaster feature, which allows you to re-use an existing SSH connection whenever you connect to a host you are already connected to.

In your ~/.ssh/config file, add:

Host *
        ControlMaster auto
        ControlPath /tmp/%r@%h:%p

Whenever you connect to server.example.com as user joeuser, SSH will create a named pipe at /tmp/joeuser@server.example.com:22. If you open another connection to the same server (as the same user), instead of creating a new TCP/IP connection, SSH will automatically multiplex the new session with the existing connection (through the named pipe)! This reduces time spent setting up new connections. Although this usual only saves a couple of seconds per connection, I’m constantly opening several simultaneous sessions; this will definitely add up to a significant savings over the long term!

No Comments »

No comments yet.

RSS feed for comments on this post. TrackBack URL

Leave a comment