我已经尝试了 3 个小时来解决这个问题。我在 serverfault 上发现了很多类似的问题,但似乎没有任何答案可以解决我的问题?
有 ssh 调试:
jfnault@jfnault-FX6840:~$ ssh -v md-web01
OpenSSH_5.9p1 Debian-5ubuntu1.4, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /home/jfnault/.ssh/config
debug1: /home/jfnault/.ssh/config line 1: Applying options for md-web01
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 54.186.190.242 [54.186.190.242] port 22.
debug1: Connection established.
debug1: identity file /home/jfnault/.ssh/md-web01.pem type -1
debug1: identity file /home/jfnault/.ssh/md-web01.pem-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
debug1: kex: client->server aes128-ctr hmac-md5 none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 72:0c:39:9f:e2:64:39:0d:51:f1:95:b6:81:9d:b2:be
The authenticity of host '54.186.190.242 (54.186.190.242)' can't be established.
ECDSA key fingerprint is 72:0c:39:9f:e2:64:39:0d:51:f1:95:b6:81:9d:b2:be.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '54.186.190.242' (ECDSA) to the list of known hosts.
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: private/md-web01
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/jfnault/.ssh/md-web01.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
〜/.ssh /配置:
Host md-web01
ChallengeResponseAuthentication yes
HostName 54.186.190.242
User ec2-user
IdentityFile ~/.ssh/md-web01.pem
.ssh 文件夹权限:
jfnault@jfnault-FX6840:~$ ls -lad .ssh/
drwxr-xr-x 3 jfnault jfnault 4096 Oct 19 11:44 .ssh/
.ssh 文件权限:
-rw------- 1 jfnault jfnault 404 Feb 16 2014 authorized_keys
-rw------- 1 jfnault jfnault 140 Oct 19 11:38 config
-rw-r--r-- 1 jfnault jfnault 222 Oct 19 11:44 known_hosts
-r-------- 1 jfnault jfnault 1696 Oct 19 11:38 md-web01.pem
答案1
找到解决方案!
好的,问题不是出在我的 ssh 配置上。
我从 ec2 控制台生成了一个密钥/对...
但这个新的密钥对没有与实例关联:S
该实例有另一个密钥对,我认为这就像创建新的密钥对并使用它一样简单......
最后,我让我的队友使用它的工作密钥对登录并为我创建另一个 ssh 密钥。
解决了!