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。

相關內容