【发布时间】:2017-09-20 17:07:02
【问题描述】:
如何直接ssh到远程服务器,下面是详细描述。
Local machine ---> Jump1 ----> Jump2 ----> Remote Server
从本地机器无法直接访问远程服务器并且 Jump2 被禁用 远程服务器只能从 Jump2 访问
远程服务器没有 sshkegen,我们必须手动输入密码。
从Local Machine我们使用ip和端口2222访问Jump1然后从Jump 1我们使用主机名默认端口22访问Jump2。
通过 ssh/config 文件,我们可以毫无问题地访问 jump2 服务器。但我的要求是直接访问远程服务器。
有什么方法可以让我不介意输入远程服务器的密码。
日志
ssh -vvv root@ip address
OpenSSH_5.3p1, OpenSSL 1.0.1e-fips 11 Feb 2013
debug1: Reading configuration data /root/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to ip address [ip address] port 22.
我的配置文件
Host jump1
Hostname ip.109
Port 2222
User avdy
Host jump2
Hostname ip.138
Port 22
ProxyCommand ssh -W %h:%p jump1
User avdy
Host remote-server
Hostname ip.8
Port 22
ProxyCommand ssh -W %h:%p jump2
User root
【问题讨论】:
-
你不需要远程服务器上的 ssh-keygen 来设置无密码身份验证,除非它在 sshd-config 中被禁用。
标签: ssh ssh-tunnel ssh-config