【发布时间】:2017-06-04 13:08:32
【问题描述】:
虽然是一个简单的问题,但我已经搜索了几天没有成功。
M = My machine
J = Jump Host
S = Server
Jump Host has my public key on authorized_keys.
Server has J's public key on authorized_keys.
Allowed connections (due to key authentication):
M -> J
J -> S
我怎么可能从我的机器 ssh 到 S?
我目前的配置是:
host jump
user root
HostName x.x.x.x
host server
user root
HostName x.x.x.x
port 22
ForwardAgent no
ProxyCommand ssh jump -W %h:%p
它不工作,因为它试图用 M 的密钥登录。
这是 ssh 日志
debug1: Host 'x.x.x.x' is known and matches the ECDSA host key.
debug1: Found key in /Users/xxxxx/.ssh/known_hosts:1542
...
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/xxxxx/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/xxxxx/.ssh/id_dsa
debug1: Trying private key: /Users/xxxxx/.ssh/id_ecdsa
debug1: Trying private key: /Users/xxxxx/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
Killed by signal 1.
【问题讨论】:
-
较新版本的 ssh 有一个
ProxyJump选项,它比ProxyCommand更直接。但最后它应该完全一样。 -
旁注:这意味着您在跳转服务器(共享服务器)上获得了您的私钥和公钥,这听起来不太安全。
标签: authentication ssh server openssh agent