Mastodon Mastodon - Unix path too long for domain socket
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. Unix path too long for domain socket

Unix path too long for domain socket

Posted on August 8, 2022  (Last modified on July 2, 2024) • 1 min read • 119 words
Cli   Solved   Ssh  
Cli   Solved   Ssh  
Share via

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:

  • gist
  • tarmac
 GitLab runners, EKS, IRSA and S3 caching
Container Linux Distributions 
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Link copied to clipboard
Code copied to clipboard