首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有主通道的SSH端口转发

带有主通道的SSH端口转发
EN

Server Fault用户
提问于 2011-05-05 15:03:35
回答 1查看 678关注 0票数 3

我正试图在现有的主通道上设置一个反向端口,但它似乎不起作用,我也不知道为什么。我设置了这样的主频道:

代码语言:javascript
复制
ssh -MN -oControlPath=/tmp/mycontrolpath hostname

我试着打开一个反向端口,如下所示:

代码语言:javascript
复制
ssh -oControlPath=/tmp/mycontrolpath -NR 10017:127.0.0.1:10017 hostname

但是第二个进程在输出中失败。

代码语言:javascript
复制
stdin: is not a tty

并且在远程主机上不打开端口转发。这似乎是协议的一个受支持的特性(无论如何,根据RFCs的说法),但我尝试使用它的速度并不快。有人把这个搞定了吗?

客户端SSH版本是OpenSSH_5.3p1 Debian-3ubuntu6,OpenSSL 0.9.8k,2009年3月25日,在服务器上连接到OpenSSH_5.5p1 Debian-6,OpenSSL 0.9.8o01。

更新

使用-vvvv运行端口转发命令将提供以下输出:

代码语言:javascript
复制
OpenSSH_5.3p1 Debian-3ubuntu6, OpenSSL 0.9.8k 25 Mar 2009
debug1: Reading configuration data /home/regularfry/.ssh/config
debug1: Applying options for *
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug3: ssh_msg_send: type 2
debug3: ssh_msg_recv entering
debug3: ssh_msg_send: type 2
debug3: ssh_msg_recv entering
stdin: is not a tty

主套接字进程的相应输出的相关部分如下所示:

代码语言:javascript
复制
debug3: fd 5 is not O_NONBLOCK
debug3: ssh_msg_recv entering
debug3: ssh_msg_send: type 2
debug3: ssh_msg_recv entering
debug3: muxserver_accept_control: receiving 2 env vars
debug2: muxserver_accept_control: accepted tty 0, subsys 0, cmd
debug2: muxserver_accept_control: got fds stdin 6, stdout 7, stderr 8
debug3: ssh_msg_send: type 2
debug2: fd 5 setting O_NONBLOCK
debug1: channel 0: new [client-session]
debug3: muxserver_accept_control: channel_new: 0
debug2: channel 0: send open
debug3: Wrote 64 bytes for a total of 2679
debug2: callback start
debug2: client_session2_setup: id 0
debug1: Sending environment.
debug1: Sending env LANG = en_GB.UTF-8
debug2: channel 0: request env confirm 0
debug1: Sending env LC_CTYPE = en_US.UTF-8
debug2: channel 0: request env confirm 0
debug2: channel 0: request shell confirm 1
debug2: callback done
debug2: channel 0: open confirm rwindow 0 rmax 32768
debug3: Wrote 192 bytes for a total of 2871
debug2: channel 0: rcvd adjust 2097152
debug2: channel_input_status_confirm: type 99 id 0
debug2: shell request accepted on channel 0
debug2: channel 0: rcvd ext data 20
debug2: channel 0: written 20 to efd 8
EN

回答 1

Server Fault用户

回答已采纳

发布于 2011-05-08 15:22:14

您的确切示例在服务器OpenSSH_5.5p1 Debian-4和客户端OpenSSH_5.8p1 Debian-4中工作得很好。所以如果可能的话我建议升级你的客户。

编辑:它也能逆转客户端和服务器(我实际上用这种方式创建了一个重定向循环),因此它可能足以在客户机上达到5.5p1。

票数 1
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/266654

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档