SSH Productivity Tips: Multiplexed connection and more

Published on August 19, 2011

With tools like SSH, Git and RSync there are always new tips you don’t know about or some clever scripts that can increase your productivity or simply save you a few keystrokes. Today’s tips come from a presentation given at YAPC Europe 2011 that have been summed up in this nice post.

The best one is obviously connection sharing, this allows you to share a single ssh connection channel with more than one ssh session, saving the few seconds needed to establish a new connection. Just two config lines that you need to put in your ~/.ssh/config:


ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r

As stated here, every user (e.g. root) that has access to your control path file will be potentially able to use your established connection, be aware of this. Furthermore, it looks like that without additional Control directives, the disconnection of the master session who opened the first connection also disconnects the other slave sessions, to fix this, as described here you just need to let the connection persist for some time (any timeout would do i guess)


ControlPersist 10m

Glad to see that the suggestion to use SSH key authentication is there too, just remember to use a strong key password (and if you haven’t done so already disable root login).

Be sure to checkout the Jumping Through Servers section, a good use of netcat.

On a related note, see Senko’s Blog for a script that using inotify launches a command when a file in a directory has been changed. He has built it to automatically perform an rsync on selected directories when changes are detected, nice.

Did you like this article? Follow me on Twitter!

Receive a notification every time I publish a new article, no spam.

This is the blog of Umberto Raimondi, you can reach me at me@this domain.

I'm also on Twitter and GitHub.

Subscribe via RSS or email.