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…)

Software Cooperative News
Smart Tricks with ssh
MJ Ray - Thursday 11.12.08, 12:11pm
Tags: GNU/Linux
| Tell A Friend | Show |







8 comments so far
1 Josh Triplett // Dec 11, 2008 at 12:44 pm
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.
2 Michal Čihař // Dec 11, 2008 at 12:55 pm
Thanks for noticing typo, fixed
.
3 Np237 // Dec 11, 2008 at 4:59 pm
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.
4 Matt Simmons // Dec 12, 2008 at 12:41 am
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!
5 Philipp K. // Dec 13, 2008 at 11:59 am
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.
6 daFux // Dec 14, 2008 at 8:02 pm
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.
7 MJ Ray // Jan 20, 2009 at 12:27 pm
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.
8 ssh with unstable and mobile clients | Software Cooperative News // Nov 21, 2009 at 7:14 am
[...] Smart Tricks with ssh mentioned ServerAliveInterval 3600 and the page I referenced for it mentions ClientAliveInterval on the server-side. Is there any reason not to use that? [...]