Shared ssh connections


OpenSSH has some really nice unknown options which you find from time to time per accident. One of them is to share a connection between different sessions. It helps a lot when you are using multiple connections to a host or using zsh autocompletion over ssh and must wait until the connection was really established.

It can easily enabled by creating a folder ~/.ssh/sock and adding some configuration options to your ~/.ssh/config for a host you want to use it

Host *
    ControlPath ~/.ssh/sock/%r@%h:%p
    ControlMaster auto
    ServerAliveInterval 60

I am little bit unsure about the security implications because it will not ask you again for your password when another connection to the same host, port and user was established.