我创build了一个EC2实例停止它再次启动它。
得到以下错误
Aloks-MacBook-Pro:AWS alokmandloi$ ssh -i working_key.pem [email protected] @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY! Someone could be eavesdropping on you right now (man-in-the-middle attack)! It is also possible that a host key has just been changed. The fingerprint for the RSA key sent by the remote host is 3d:f2:79:cc:38:66:83:71:1b:86:6c:7e:36:ad:27:bc. Please contact your system administrator. Add correct host key in /Users/alokmandloi/.ssh/known_hosts to get rid of this message. Offending RSA key in /Users/alokmandloi/.ssh/known_hosts:11 RSA host key for ec2-184-73-22-113.compute-1.amazonaws.com has changed and you have requested strict checking. Host key verification failed.
我查了一下解决办法,发现http://www.thegeekstuff.com/2010/04/how-to-fix-offending-key-in-sshknown_hosts-file/
哪个build议我删除known_hosts中的第11个条目。 这样做后,我得到以下错误
Aloks-MacBook-Pro:AWS alokmandloi$ ssh -v -i working_key.pem [email protected] OpenSSH_5.9p1, OpenSSL 0.9.8r 8 Feb 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: Connecting to ec2-184-73-22-113.compute-1.amazonaws.com [184.73.22.113] port 22. debug1: Connection established. debug1: identity file working_key.pem type -1 debug1: identity file working_key.pem-cert type -1 debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3 debug1: match: OpenSSH_5.3 pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_5.9 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: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA 3d:f2:79:cc:38:66:83:71:1b:86:6c:7e:36:ad:27:bc debug1: Host 'ec2-184-73-22-113.compute-1.amazonaws.com' is known and matches the RSA host key. debug1: Found key in /Users/alokmandloi/.ssh/known_hosts:10 debug1: ssh_rsa_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: Trying private key: working_key.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).
要么你有错误的键或错误的地址为实例(已拒绝您的密钥)。
如果您停止并启动您的实例,则您的公共IP和主机名将发生更改。 即使您使用的是ElasticIP,“停止”也会使EIP解除关联。
查看您的AWS控制台,看看新的公网IP /主机名是什么,您可能正试图连接到旧的DNS名称,现在可能已经分配给其他人的实例。
最好是因为更多的失败 – certificate去除有问题的主机密钥
ssh-keygen -R hostname
在你的情况
ssh-keygen -R ec2-184-73-22-113.compute-1.amazonaws.com
如果您确定您的密钥是正确的,那么您也可以在服务器上validation.ssh/authorized_keys具有正确的权限(对于.ssh/为700 ,对于.ssh/authorized_keys为600 )
停止正在运行的实例时,会发生以下情况:
该实例执行正常关机并停止运行; 其状态变为停止然后停止。
任何Amazon EBS卷都将保留附加到该实例,并且其数据仍然存在。
存储在主机的RAM或主机的实例存储卷中的任何数据都消失了。
EC2-Classic:我们在停止实例时释放实例的公有和私有IP地址,并在重新启动时分配新的IP地址。
EC2-VPC:实例在停止和重新启动时保留其私有IP地址。 我们释放公共IP地址,并在重新启动时分配一个新的IP地址。
你的实例必须有新的公共IP。 请检查并尝试使用新的IPlogin到您的服务器。