Host *
ControlMaster auto
ControlPath ~/.ssh/cm_socket/%r@%h:%p Host *
ControlMaster auto
ControlPath ~/.ssh/cm_socket/%r@%h:%pThis fixes the UI wart where your first ssh connection to a server has to stay open for the duration of all your others (or your others all get forcibly disconnected).
It's not perfect. If the name of a server changes but you already have a control socket, it'll use the socket and connect to the old server. And it also takes it a while to pick up networking changes that break your connectivity, though I've hacked around that with a script I keep running in the background (Linux only, at the moment; requires gir1.2-networkmanager-1.0):
#!/usr/bin/python
import os
from gi.repository import GLib, NMClient
def active_connections_changed(*args):
for sock in os.listdir(os.path.expanduser('~/.ssh/sockets')):
os.unlink(os.path.join(os.path.expanduser('~/.ssh/sockets'), sock))
c = NMClient.Client.new()
c.connect('notify::active-connections', active_connections_changed)
GLib.MainLoop().run()
There's some contention with my coworkers about whether ControlPersist is actually desirable given the tradeoffs, but I personally think it's a huge improvement.$> man controlmaster
No manual entry for controlmaster
$> man ssh|grep -i controlmaster
required before slave connections are accepted. Refer to the description of ControlMaster in ssh_config(5) for details.
ControlMaster description of ControlPath and ControlMaster in ssh_config(5) for details.
$> man ssh_config|grep -i controlmaster
ControlMaster
with ControlMaster set to “no” (the default). These sessions will try to reuse the master instance's network connection rather than
Specify the path to the control socket used for connection sharing as described in the ControlMaster section above or the string
When used in conjunction with ControlMaster, specifies that the master connection should remain open in the background (waiting for
[1]: http://www.reddit.com/r/fossworldproblems/comments/v7hi1/man...