Ok, the title might be a bit confusing so here's what I'm trying to achieve.
I have multiple machines of types A that would connect to a server B. All machines of type A would have some kind of GUID.
What I'm trying to achieve is that machine A would initiate a SSH tunnel to server B then someone from his personal computer can connect to machines of type A through server B.
I'm able to port forward it like this:
ssh -R 3000:localhost:22 server_host -p 58122
But that's not really convenient as I'd have to guess an unused port.
I'd rather have something like this:
ssh -R /tmp/nodes/${guid}.sock:localhost:22 server_host -p 58122
Then something like this from the server B:
ssh /tmp/nodes/${guid}.sock
But the first command always return this:
Warning: remote port forwarding failed for listen path /tmp/guid.sock
As if the socket couldn't be created. The ssh client connect to the server B but cannot initiate a socket for its own ssh port.
The main goal is to be able to create a SSH tunnel from the node machines A to the server B. The reason is that those machines are hidden behind a network and there is no real other way to create a tunnel from Server B to nodes A.
I'm not even sure ssh can connect directly to a socket so if there is an alternative to port forwarding I'd be happy to know.
remote port forwarding failed
probably because there is/tmp/guid.sock
on B from your previous try. The fact a socket gets left behind will complicate your procedure. Connecting to a valid socket is possible.