简体   繁体   English

Amazon实例不再允许使用私钥登录

[英]Amazon instance no longer allowing login with private key

I've been through so many questions on SO like this and none of them have worked, but also I can pinpoint when this happened so I may be able to add another layer of detail. 我已经在SO这样的问题上经历了很多问题,但都没有成功,但是我也可以查明发生的时间,这样我就可以添加更多细节。

Most of the solutions indicate that the asker is: 大多数解决方案都表明请求者是:

  1. using the incorrect key 使用不正确的密钥
  2. incorrect username. 用户名不正确。 This is an Ubuntu image and I've tried 'ubuntu', 'ec2-user', and the new username that I created for myself on the machine. 这是一个Ubuntu映像,我尝试使用“ ubuntu”,“ ec2-user”以及我在计算机上为自己创建的新用户名。 None work; 没有工作; all same error message. 所有相同的错误消息。

Either instance suggests trying: ssh -i kename.pem username@host -vvv , and this is the way that always worked for me in the past.... until I reimaged my client machine. 这两个实例都建议尝试: ssh -i kename.pem username@host -vvv ,这是过去一直对我ssh -i kename.pem username@host -vvv的方法....直到我重新镜像客户机之前。 Ever since then I've gotten the attached ssh trace. 从那时起,我就获得了附带的ssh跟踪。

I've tried the second level attempt of creating an AMI from the server I'm locked out of, spinning up a new instance, creating a new key, and trying to log into the new instance. 我已经尝试了第二级尝试,即从被锁定的服务器创建AMI,旋转新实例,创建新密钥并尝试登录到新实例。 No luck there. 那里没有运气。

So, my question is: is there something that could have been on the old machine, possibly my public key or something, that I no longer have and thus cannot connect to any of the instances? 所以,我的问题是:旧机器上可能有什么东西,可能是我的公共密钥,或者是我不再拥有的东西,因此无法连接到任何实例? I was under the impression that you only need the private key to authenticate. 我的印象是您只需要私钥进行身份验证。 I'm pretty thin on SSH protocol aside from logging into machines with it, the trace below doesn't seem to give me any hints as to where this breaks down with the exception of "debug1: Roaming not allowed by server", but maybe that's not relevant and I'm making a bigger deal of it than it is. 除了使用它登录计算机外,我对SSH协议的了解还很薄,下面的踪迹似乎没有给我任何提示,除了“ debug1:服务器不允许漫游”外,它在哪里崩溃了,但是也许这无关紧要,我正在做的事比实际要多。

I'm hoping the reimaging portion of this question sheds some other light on the subject. 我希望这个问题的重新想象部分能为这个问题提供其他一些启示。

OpenSSH_5.9p1, OpenSSL 1.0.0e 6 Sep 2011
debug2: ssh_connect: needpriv 0
debug1: Connecting to **hostname** [**hostname**] port 22.
debug1: Connection established.
debug1: identity file /.ssh/id_rsa type -1
debug1: identity file /.ssh/id_rsa-cert type -1
debug1: identity file /.ssh/id_dsa type -1
debug1: identity file /.ssh/id_dsa-cert type -1
debug1: identity file /.ssh/id_ecdsa type -1
debug1: identity file /.ssh/id_ecdsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.9p1 Debian-5ubuntu1.4
debug1: match: OpenSSH_5.9p1 Debian-5ubuntu1.4 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.9
debug2: fd 100 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ecdsa-sha2-nistp256-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,ssh-rsa-cert-v00@openssh.com,ssh-dss-cert-v00@openssh.com,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,ecdsa-sha2-nistp521,ssh-rsa,ssh-dss
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: zlib@openssh.com,zlib,none
debug2: kex_parse_kexinit: zlib@openssh.com,zlib,none
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: kex_parse_kexinit: ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group-exchange-sha1,diffie-hellman-group14-sha1,diffie-hellman-group1-sha1
debug2: kex_parse_kexinit: ssh-rsa,ssh-dss,ecdsa-sha2-nistp256
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,aes192-cbc,aes256-cbc,arcfour,rijndael-cbc@lysator.liu.se
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-sha2-256,hmac-sha2-256-96,hmac-sha2-512,hmac-sha2-512-96,hmac-ripemd160,hmac-ripemd160@openssh.com,hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: none,zlib@openssh.com
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: 
debug2: kex_parse_kexinit: first_kex_follows 0 
debug2: kex_parse_kexinit: reserved 0 
debug2: mac_setup: found hmac-md5
debug1: kex: server->client aes128-ctr hmac-md5 zlib@openssh.com
debug2: mac_setup: found hmac-md5
debug1: kex: client->server aes128-ctr hmac-md5 zlib@openssh.com
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA ea:b9:58:59:16:ff:cc:89:72:50:ab:f7:8f:40:ef:3b
The authenticity of host '**hostname** (**hostname**)' can't be established.
ECDSA key fingerprint is ea:b9:58:59:16:ff:cc:89:72:50:ab:f7:8f:40:ef:3b.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '**hostname**' (ECDSA) to the list of known hosts.
debug1: ssh_ecdsa_verify: signature correct
debug2: kex_derive_keys
debug2: set_newkeys: mode 1
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug2: set_newkeys: mode 0
debug1: SSH2_MSG_NEWKEYS received
debug1: Roaming not allowed by server
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: /.ssh/id_rsa (0x0)
debug2: key: /.ssh/id_dsa (0x0)
debug2: key: /.ssh/id_ecdsa (0x0)
debug1: Authentications that can continue: publickey
debug3: start over, passed a different list publickey
debug3: preferred publickey,keyboard-interactive,password
debug3: authmethod_lookup publickey
debug3: remaining preferred: keyboard-interactive,password
debug3: authmethod_is_enabled publickey
debug1: Next authentication method: publickey
debug1: Trying private key: /.ssh/id_rsa
debug1: could not open key file '/.ssh/id_rsa': Invalid argument
debug1: Trying private key: /.ssh/id_dsa
debug1: could not open key file '/.ssh/id_dsa': Invalid argument
debug1: Trying private key: /.ssh/id_ecdsa
debug1: could not open key file '/.ssh/id_ecdsa': Invalid argument
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).

Whould you join the exact command you are trying? 您想跟谁一起输入确切的命令?

And the output of ls $HOME/.ssh ? 和ls $ HOME / .ssh的输出?

If you read carefully through the stacktrace it looks like SSH does not find any key at the default locations. 如果仔细阅读stacktrace,SSH似乎在默认位置找不到任何密钥。 The server replies that you did not provide the right key, the debug output tells me that you did not provide any key. 服务器答复您未提供正确的密钥,调试输出告诉我您未提供任何密钥。

So find out first where you private key is on your client computer :) 因此,首先找出您的私钥在客户端计算机上的位置:)

Then move it to .ssh/id_rsa or do ssh -i <key_location> ubuntu@myhost as suggested in the comments. 然后将其移动到.ssh / id_rsa或按照注释中的建议执行ssh -i <key_location> ubuntu@myhost

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM