I wanted to SSH into a machine, and I got a very weird error message: unix_listener: path "/Users/me/.ssh/sockets/myservername_ansible@000-servername001.subdomain.main-domain-in-use.de-22.gFthlK8q5qNkrXW4" too long for Unix domain socket
.
This seems to be the culprit:
- I am “persisting” SSH connections in my SSH config folder, precisely here:
$HOME/.ssh/sockets
- The configuration for this is:
Host ... ControlMaster auto ControlPath ~/.ssh/sockets/%r@%h-%p ControlPersist 600
- Before opening a connection, SSH looks for an existing socket in
$HOME/.ssh/sockets
, and if found re-uses it - There is a 100-something length limit for “path to a socket” under Mac OS
- This path length limit was overshot with that 106-character long path
Solution: Shorten the path by using %C
instead of %r@%h-%p
:
Host ...
ControlMaster auto
ControlPath ~/.ssh/sockets/%C
That is it.
Sources: