Host *
ControlPath ~/.ssh/sock/%r@%h:%p
ControlMaster auto
from Nijel’s weblog: Speed up SSH logins – is there any disadvantage to this? Also, “completition” is a great typo along the lines of my frequent “abou tit” one.ServerAliveInterval 3600for reasons explained in the comments here.- Anything you like on the Standalone Sysadmin SSH series (ok, I cheated to get a list of three…)
-
Recent Posts
Recent Comments
Blogroll
Archives
- February 2012
- January 2012
- December 2011
- November 2011
- October 2011
- September 2011
- August 2011
- July 2011
- June 2011
- May 2011
- April 2011
- March 2011
- February 2011
- January 2011
- December 2010
- November 2010
- October 2010
- September 2010
- August 2010
- June 2010
- May 2010
- April 2010
- March 2010
- February 2010
- January 2010
- December 2009
- November 2009
- October 2009
- September 2009
- August 2009
- July 2009
- June 2009
- May 2009
- April 2009
- March 2009
- February 2009
- January 2009
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
Categories
Meta

Yes, ControlMaster auto does have one major disadvantage: the first SSH session you start to a new system becomes the control master, and thus it can’t exit until all other SSH sessions using that same control master exit. So if you go to a terminal, run SSH, and then in another window do something else that opens an SSH session to the same host, the SSH in your original terminal will not exit after you quit.
However, if you set ControlPath but not ControlMaster, you can still enable ControlMaster for a specific SSH connection with the -M option to ssh. That way, you can control which instance of SSH becomes the control master.
Personally, I wish SSH had the ability to fork off a new control master in the background if one doesn’t already exist, and then that control master could automatically exit if a given amount of time passes since the last connection.
Thanks for noticing typo, fixed
.
I have noticed two major issues while using ControlMaster already:
– port forwarding only seems to work in the master session
– after some time, new connections are rejected, and I have yet to understand why.
Hi! Thanks a lot for the link to Standalone Sysadmin. I’m glad you found the series useful. Most of the credit goes to the other people who have been writing the other entries, but I’m happy to point to them!
Take care!
Port forwarding only works in the master session, but since most of my port forwardings are setup in .ssh/config anyway, that doesn’t bother me too much.
More annoying is IMHO that agent- and X-forwarding also only works when you thought of it at the time of establishing the master session. I often have to go through my tabs to find and kill the master session to a particular host, because the need for remote X or key forwarding only came up later.
Even so, I’m still staying with “ControlMaster auto”, as it certainly causes more convenience than harm for me.
Portforwarding (or rather the lack of it in the non-master sessions) is a serious issue. “ssh -S none” is your friend in such a situation.
Pete Savage: SSH tunneling :: The next step http://www.progbox.co.uk/wordpress/?p=580 describes the -w flag which was a new one on me, setting up tun network devices.
Pingback: ssh with unstable and mobile clients | Software Cooperative News