title: Shared SSH connection with Control Master not working
body: <p>I have set up sharing an ssh connection on my local machine fine, but when I try and do this on our CI server it is failing and I cant work out why.</p>
  
  <p>the ~/.ssh/config is</p>
  
  <pre><code>StrictHostKeyChecking=no
  Host *
  ControlMaster auto
  ControlPath ~/.ssh/control:%h:%p:%r
  ControlPersist 2h
  </code></pre>
  
  <p>First connection will fail, but will create the socket, second connection will fail as the socket is stale.</p>
  
  <p>The end of the verbose output from first connection is....</p>
  
  <pre><code>$ ssh -vvvv -N  user@domain.co.uk
  
  ....
  
  debug1: Enabling compatibility mode for protocol 2.0
  debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.6
  debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
  debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* compat 0x04000000
  
  ....
  
  Authenticated to domain.co.uk ([88.47.112.93]:22).
  debug1: setting up multiplex master socket
  debug3: muxserver_listen: temporary control path /home/rof/.ssh/control:domain.co.uk:22:user.3HfyjbhRCDHGwnrI
  debug2: fd 4 setting O_NONBLOCK
  debug3: fd 4 is O_NONBLOCK
  debug3: fd 4 is O_NONBLOCK
  debug1: channel 0: new [/home/rof/.ssh/control:domain.co.uk:22:user]
  debug3: muxserver_listen: mux listener channel 0 fd 4
  debug2: fd 3 setting TCP_NODELAY
  debug3: packet_set_tos: set IP_TOS 0x08
  debug1: control_persist_detach: backgrounding master process
  debug2: control_persist_detach: background process is 84004
  Control socket connect(/home/rof/.ssh/control:domain.co.uk:22:user): Connection refused
  Failed to connect to new control master
  debug1: forking to background
  debug1: Entering interactive session.
  debug2: set_control_persist_exit_time: schedule exit in 7200 seconds
  </code></pre>
  
  <p>If you run it without the -N option the command input just hangs.</p>
  
  <p>any subsequent ssh connections say the socket is stale and unlink it, thus not using a shared connection.</p>
  
  <p>Any ideas?</p>