Hacker News new | ask | show | jobs
by CraigJPerry 1504 days ago
Modern ssh supports forwarding of Unix domain sockets

On remote host:

    $ tmux -S /tmp/remote.sock
    <now detach from session: prefix d>
On local host:

    $ ssh -L /tmp/local.sock:/tmp/remote.sock user@remote
    $ tmux -S /tmp/local.sock attach

I Typed this on a phone and not validated but it looks good to me right now
1 comments

Have you tried this before? As far as I can tell, tmux expects to pass the client's terminal fd over the unix socket. When I try it, I get something like this in strace (passing fd 7):

  > sendmsg(5, {..., msg_control=[{cmsg_len=20, cmsg_level=SOL_SOCKET, cmsg_type=SCM_RIGHTS, cmsg_data=[7]}], msg_controllen=24, msg_flags=0}, 0) = 16
And then the client relays an error:

  > open terminal failed: not a terminal
I hadn’t, i just tried it now and yeah it doesn’t work :thumbsdown: