All notes2026-09-30

SSH Control Paths Include Their Directories

A short hashed socket name does not help if the directories above it are long.

SSH multiplexing keeps a control socket at whatever ControlPath points to. I used %C, the hashed connection name, and assumed that kept the path short. It does not. Unix socket paths have a length limit, and every parent directory counts toward it.

A config like this can still fail on a machine with a long home directory:

ControlPath ~/.ssh/some-tool/sockets/%C

Dropping a directory level buys back room without giving up the hashed name:

ControlPath ~/.ssh/some-tool/%C

Lesson

When a Unix socket path is rejected as too long, measure the whole expanded path, not just the filename.