我希望通过SSH转发命名管道,从远程Windows机器转发到本地计算机。远程Windows计算机正在运行sshd
(OpenSSH)。我要转发的管道是Docker Engine API,尽管这不重要。
要从远程Unix机器转发等效的Unix域套接字,我会运行(并且这样可行):
ssh -NL localhost:2374:/var/run/docker.sock user@host
名为pipe的远程Windows机器的等效项将是:
ssh -NL localhost:2373://./pipe/docker_engine Administrator@windows-host
channel 2: open failed: administratively prohibited: open failed
我正在使用PowerShell/OpenSSH。在调试模式下运行sshd,我在尝试通过隧道连接时看到了这一点:
debug1: Entering interactive session for SSH2.
debug1: pipe - read end: handle:0000000000000244, io:000001C199D59F20, fd:4
debug1: pipe - write end: handle:0000000000000238, io:000001C199D3F5F0, fd:6
debug1: server_init_dispatch_20
debug1: server_input_global_request: rtype no-more-sessions@openssh.com want_reply 0
debug1: server_input_channel_open: ctype direct-streamlocal@openssh.com rchan 2 win 2097152 max 32768
debug1: server_request_direct_streamlocal: originator ::1 port 59191, target //./pipe/docker_engine
debug1: socket - socket() ERROR:47, io:000001C199D593F0
socket: Unknown error
connect to //./pipe/docker_engine port -2 failed: Unknown error
debug1: server_input_channel_open: failure direct-streamlocal@openssh.com
debug1: server_input_channel_open: ctype direct-streamlocal@openssh.com rchan 2 win 2097152 max 32768
debug1: server_request_direct_streamlocal: originator ::1 port 59192, target //./pipe/docker_engine
debug1: socket - socket() ERROR:47, io:000001C199D593F0
socket: Unknown error
connect to //./pipe/docker_engine port -2 failed: Unknown error
debug1: server_input_channel_open: failure direct-streamlocal@openssh.com
答案 0 :(得分:2)
首先,你在第二个例子中交换了前两个参数本地地址和端口的顺序:
ssh -NL localhost:2374:/var/run/docker.sock user@host
ssh -NL 2374:localhost:\\\\.\\pipe\\docker_engine user@host
^^^^^^^^^^^^^^
第一种形式是正确的:
ssh -NL localhost:2374:.... user@host
关于命名管道的路径,OpenSSH ssh
实用程序只会将前向规范字段视为路径名,如果它包含“/”(正斜杠)。用正斜杠替换一个或多个(转义的)反斜杠应该让ssh将其识别为路径:
ssh -NL localhost:2374:\\\\.\\pipe/docker_engine user@host
我不知道生成的路径是否是远程系统上的有效路径名。如果远程服务器是Cygwin OpenSSH,那么它应该接受Cygwin-supported formats中的路径名,包括UNC paths。您可以尝试用“/”替换所有“\”对:
ssh -NL localhost:2374://./pipe/docker_engine user@host
答案 1 :(得分:0)
仅研究了此主题,发现尚不支持该主题。请检查这些票的状态: