Git Bash 中的反向 SSH 失败,显示“connect_to localhost port X: failed”

Git Bash 中的反向 SSH 失败,显示“connect_to localhost port X: failed”

我正在尝试帮助我的同事从他们的本地 PC 到我们的远程开发服务器创建反向 SSH 隧道。

反向 SSH 隧道对我来说运行良好。但对他们来说却不起作用。

他们运行的命令如下所示:

ssh -v -R 9000:localhost:9000 [email protected]

以下是他们得到的输出示例

debug1: client_input_channel_open: ctype forwarded-tcpip rchan 3 win 2097152 max 32768
debug1: client_request_forwarded_tcpip: listen localhost port 9000, originator ::1 port 36142
debug1: getsockopt TCP_NODELAY: Invalid argument                                              
debug1: connect_next: host localhost ([::1]:9000) in progress, fd=8
debug1: channel 1: new [::1]                                                                  
debug1: confirm forwarded-tcpip                                                               
debug1: channel 1: connection failed: Connection refused
debug1: getsockopt TCP_NODELAY: Invalid argument                                              
debug1: connect_next: connect host localhost ([::1]:9000) in progress, fd=9                  
connect_to localhost port 9000: failed
debug1: channel 1: free: ::1, nchannels 2

与我得到的输出相比

debug1: client_input_channel_open: ctype forwarded-tcpip rchan 3 win 2097152 max 32768
debug1: client_request_forwarded_tcpip: listen localhost port 9001, originator ::1 port 59996
debug1: connect_next: start for host localhost ([::1]:9001)                                  
debug1: getsockopt TCP_NODELAY: Invalid argument                                              
debug1: connect_next: connect host localhost ([::1]:9001) in progress, fd=8                  
debug1: channel 1: new [::1]                                                                  
debug1: confirm forwarded-tcpip                                                               
debug1: channel 1: connection failed: Connection refused
debug1: connect_next: start for host localhost ([127.0.0.1]:9001)                
debug1: connect_next: connect host localhost ([127.0.0.1]:9001) in progress, fd=9
debug1: channel 1: connected to localhost port 9001                              
debug1: channel 1: free: ::1, nchannels 2

我看到的主要区别是,在我的输出中,IP 变为 v4,而在他们的输出中,IP 保持为 V6。端口号是故意不同的(他们使用 9000,我使用 9001)

我们尝试完全关闭 Windows Defender,以防出现防火墙问题。但没成功。


我们正在 Git Bash 中运行该命令。which bash返回/usr/bin/bash。如果有任何区别,我正在尝试在远程服务器上使用 Xdebug 设置我的同事。

相关内容