我正在跟踪这一资源为ssh设置类似于代理服务器的内容
我的设置和文章中提到的一模一样:
Remote Server A
Machine-1
Machine-2计算机-1是一台堡垒服务器,我可以从它从ssh到远程服务器(使用标识文件)。
机器-2可以使用密码连接到机器-1。
要求:
通过机器-1从Mach-2连接到远程服务器(A)
Machine-2 <--> Machine-1 <--> Remote Server(A)这里我的命令看起来如何(从机器-2运行这个命令)
ssh -o "ProxyCommand=ssh -W user2@%h:%p user1@machine-1" user2@remote_server 但我还没有看到成功。
我所看到的错误
channel 0: open failed: connect failed: nodename nor servname provided, or not known
stdio forwarding failed
kex_exchange_identification: Connection closed by remote host 我不经常这样,所以我不知道出了什么问题。但根据资源,这一步在我看来是正确的。
发布于 2020-10-21 09:35:09
您不需要在user2@中使用ProxyCommand部分。这应该是可行的:
ssh -o "ProxyCommand=ssh -W %h:%p user1@machine-1" user2@remote_server但是,为此编写一个配置可能更容易一些。另外,如果您使用ProxyJump而不是ProxyCommand,那么配置将更容易阅读。将以下行写入您的~/.ssh/config文件:
Host machine-1
User user1
Host remote_server
User user2
ProxyJump machine-1然后,只需发出ssh remote_server命令就可以登录到remote_server,使用machine-1作为垫脚石。
https://serverfault.com/questions/1039536
复制相似问题