ssh 错误消息中的通道号是指什么?

ams*_*ams 12 ssh openssh ssh-tunneling sshd

在下面的例子中,通道号对应什么?服务器上有哪些?哪些在客户端?

  $ ssh -L1570:127.0.0.1:8899 root@thehost
    Password:
    Last login: Fri Aug  9 13:08:44 2013 from theclientip
    Sun Microsystems Inc.   SunOS 5.10      Generic January 2005
    You have new mail.
    # channel 2: open failed: administratively prohibited: open failed
    channel 3: open failed: administratively prohibited: open failed
    channel 2: open failed: administratively prohibited: open failed
Run Code Online (Sandbox Code Playgroud)

ssh 客户端在 Windows 7 上运行,服务器有一个在端口 8899 上运行的 Tomcat 服务器。

Tomcat 没有在远程机器上监听 127.0.0.1,所以如果我将命令更改ssh -L1570:thehostpublicip:8899 root@thehost为端口转发工作。所以我知道端口转发似乎在服务器上工作得很好。

我的 sshd 配置文件包含以下两行:

# Port forwarding
AllowTcpForwarding yes

# If port forwarding is enabled, specify if the server can bind to INADDR_ANY.
# This allows the local port forwarding to work when connections are received
# from any remote host.
GatewayPorts yes
Run Code Online (Sandbox Code Playgroud)

我正在尝试为另一个进程而不是 Tomcat 设置端口转发,并且收到类似于上述内容的错误消息,因此我试图了解错误消息的含义。

slm*_*slm 22

SSH 协议文档中,关于通道:

所有终端会话、转发连接等都是通道。任何一方都可以打开一个通道。多个通道被复用为一个连接。

通道由每一端的数字标识。每一侧涉及频道的数字可能不同。打开频道的请求包含发件人的频道号。任何其他与频道相关的消息都包含该频道的收件人频道编号。

通道是流量控制的。在接收到消息以指示窗口空间可用之前,不得向通道发送数据。

转发端口

您拥有的命令看起来不错。您确定您尝试连接的服务已启动并接受连接吗?通道错误似乎表明它不是。

我的活跃渠道有哪些?

如果您有活动ssh连接,您可以使用以下组合键获得帮助:

Shift+~后跟Shift+?

$ ~?
Supported escape sequences:
  ~.  - terminate connection (and any multiplexed sessions)
  ~B  - send a BREAK to the remote system
  ~C  - open a command line
  ~R  - Request rekey (SSH protocol 2 only)
  ~^Z - suspend ssh
  ~#  - list forwarded connections
  ~&  - background ssh (when waiting for connections to terminate)
  ~?  - this message
  ~~  - send the escape character by typing it twice
(Note that escapes are only recognized immediately after newline.)
debug2: channel 2: written 480 to efd 8
Run Code Online (Sandbox Code Playgroud)

然后,您可以使用此组合键来获取活动频道的列表:

Shift+~后跟Shift+#

$ ~#
The following connections are open:
  #2 client-session (t4 r0 i0/0 o0/0 fd 6/7 cc -1)
debug2: channel 2: written 93 to efd 8
Run Code Online (Sandbox Code Playgroud)