A rantbox

Fri 03 August 2018

Fixing the 'unix_listener too long for Unix domain socket' problem

Posted by Michiel Scholten in howto   

In my ~/.ssh/config file, I have been using a socket file for every host that I connect to, so TCP sessions can be re-used for faster connecting to a host I already am connected to. I had several iterations of the exact filename for this, as with longer hostnames, the filename becomes too long.

So after ControlPath ~/.ssh/sockets/%r@%h-%p and ControlPath ~/.ssh/sockets/%r@%h I still ran into problems. Luckily, I came across this helpful gist which mentioned the %C formatting option to generate a hash of %l%h%p%r instead of printing the whole hostname including fully qualified domain name and such. The following snippet works wonders:

Host *
    ControlPath ~/.ssh/control/%C
    ControlMaster auto