SSH exitOnForwardFailure=yes 不适用于本地转发(-L)

SSH exitOnForwardFailure=yes 不适用于本地转发(-L)

我想使用ExitOnForwardFailuressh 选项,但它似乎不起作用:

$ ssh -f -L 8080:localhost:22 -o ExitOnForwardFailure=yes [email protected] "sleep 60" ; sleep 3; ps xu|grep ssh
bind: Address already in use
halfgaar     780086  0.0  0.0  51432   728 ?        Ss   12:32   0:00 ssh -f -L 8080:localhost:22 -o ExitOnForwardFailure=yes [email protected] sleep 60

另外如果我不 fork( -f) 的话,我只会获得服务器的 shell:

halfgaar@<localmachine>: ~
$ ssh -L 8080:localhost:22 -o ExitOnForwardFailure=yes [email protected]
bind: Address already in use
Linux <remoteserver> 4.9.0-8-686-pae #1 SMP Debian 4.9.144-3 (2019-02-02) i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Fri May 31 12:39:27 2019 from 84.22.107.110
root@<remoteserver>: ~
#

当我尝试制作撤销隧道 (-R)。

Ubuntu 18.04,SSH 7.6p1-4ubuntu0.3。

答案1

看起来它的一部分使用了 ipv4,另一部分使用了 ipv6。当我使用 时-4,我正确地得到了:

bind: Address already in use
channel_setup_fwd_listener_tcpip: cannot listen to port: 8080                                                                                                                                                                                                                 
Could not request local forwarding.

我也提交错误报告,因为它看起来确实像一个错误。

相关内容