getpeername 失败:文件描述符错误

Mar*_*ara 5 ssh ssh-tunnel

我使用跳转主机从 Windows 10 电脑上的 OracleLinux 8.4 VM(在 VirtualBox 上配置了 NatNetwork)运行脚本到远程主机。

我的电脑无法直接连接远程主机,连接VPN后需要经过跳转主机。

这是我的环境:

服务器 知识产权
Windows PC 局域网: 192.168.0.10
Windows PC VPN: 10.201.66.134
OracleLinux 虚拟机: 10.0.100.100
跳跃主机 90.xxx

我在脚本中使用这些参数:

-o ProxyCommand="sshpass -p $SSHPASS ssh -vvv -W %h:%p ispjh" 
-o PubkeyAuthentication=no 
-o PreferredAuthentications=password 
-o PasswordAuthentication=yes 
-o ControlMaster=auto 
-o ControlPersist=60s 
-o UserKnownHostsFile=/dev/null 
-o StrictHostKeyChecking=no 
Run Code Online (Sandbox Code Playgroud)

这是我在虚拟机上的 ssh 配置: [root@VM ~]# cat ~/.ssh/config Host * TCPKeepAlive no ServerAliveInterval 300 ServerAliveCountMax 1296000

Host jumphost jumphost.mydonain.local
Hostname jumphost.mydonain.local
User user.name
ControlMaster auto
ControlPath /tmp/ssh-%r@%h:%p
DynamicForward 1083
Run Code Online (Sandbox Code Playgroud)

我在运行脚本之前(使用命令:)和之后创建了 SSH 隧道ssh jumphost -v,但是当我运行脚本(在新 shell 上)时,一段时间后我收到以下错误:
来自 SSH 隧道连接:

debug1: getpeername failed: Bad file descriptor
debug1: channel 5: free: direct-tcpip: listening port 0 for 10.12.12.14 port 22, connect from 127.0.0.1 port 65535 to UNKNOWN port 65536, nchannels 9
Run Code Online (Sandbox Code Playgroud)

有时脚本返回并且连接断开。我该如何解决这个问题?感谢您的支持。