通过多台机器实现SSH的更好方法
我目前必须SSH 3次才能进入我需要的机器:通过多台机器实现SSH的更好方法,ssh,Ssh,我目前必须SSH 3次才能进入我需要的机器: ssh gatekeeper [passwd1] ssh master_server [passwd2] ssh my_machine [passwd3] 有更好的方法进入我的机器吗?每次都要这么做很麻烦。我真的不知道如何使用3ssh,但下面是我使用2的方法(比如:me->master\u server->my\u machine) 您需要在家中添加配置文件: ~/.ssh/config 然后在该文件中写入: Host my_machine
ssh gatekeeper
[passwd1]
ssh master_server
[passwd2]
ssh my_machine
[passwd3]
有更好的方法进入我的机器吗?每次都要这么做很麻烦。我真的不知道如何使用3ssh,但下面是我使用2的方法(比如:me->master\u server->my\u machine) 您需要在家中添加配置文件:
~/.ssh/config
然后在该文件中写入:
Host my_machine
Hostname my_machine.example.com
ProxyCommand ssh other_or_same_login@master_server -W %h:%p
你打电话
ssh login@my_machine
然后,您必须输入两次密码(在您的情况下输入三次)。如果不想键入密码,可以使用密钥访问选项
对于另一个ssh,我想您需要在配置文件中编写另一个部分,但是由于我无法尝试,所以我不想说错话
希望这有帮助。很好-这很有效:
Host my_machine
Hostname my_machine
ProxyCommand ssh user2@master_server -W %h:%p
ProxyCommand ssh user1@gatekeeper -W %h:%p
这与编程有关吗?如果没有,您可能想尝试SuperUser/ServerFault(使用特定的网络信息)。谢谢,这对两台机器都有效。现在我必须找出在哪里为第三台机器添加命令(如果可能的话)