无法SSH进入Amazon EC2实例
我花了将近24小时试图弄清楚我做错了什么,但我无法弄清楚这一点。开始觉得我的本地设置有问题。无法SSH进入Amazon EC2实例
- 我已确认于chmod 400埃里克 - keypair.pem
- 我已经存储埃里克 - keypair.pem在我的用户的.ssh文件夹,迁至其他id_rsa文件,只是让他们不这样做干扰(试图删除任何变量)
- EC2实例安全具有SSH启用
这里的响应
$ ssh -v -v -i erik-keypair.pem [email protected]
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /etc/ssh_config
debug2: ssh_connect: needpriv 0
debug1: Connecting to ec2-XX-XX-XX-XXX.compute-1.amazonaws.com [XX.XX.XX.XXX] port 22.
debug1: Connection established.
debug2: key_type_from_name: unknown key type '-----BEGIN'
debug2: key_type_from_name: unknown key type '-----END'
debug1: identity file erik-keypair.pem type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-5ubuntu1
debug1: match: OpenSSH_5.1p1 Debian-5ubuntu1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug2: fd 3 setting O_NONBLOCK
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug2: kex_parse_kexinit: 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
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,[email protected]
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,[email protected]
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected],zlib
debug2: kex_parse_kexinit: none,[email protected],zlib
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: 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
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: aes128-cbc,3des-cbc,blowfish-cbc,cast128-cbc,arcfour128,arcfour256,arcfour,aes192-cbc,aes256-cbc,[email protected],aes128-ctr,aes192-ctr,aes256-ctr
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: hmac-md5,hmac-sha1,[email protected],hmac-ripemd160,[email protected],hmac-sha1-96,hmac-md5-96
debug2: kex_parse_kexinit: none,[email protected]
debug2: kex_parse_kexinit: none,[email protected]
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 none
debug2: mac_setup: found hmac-md5
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
debug2: dh_gen_key: priv key bits set: 124/256
debug2: bits set: 502/1024
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-XX-XX-XX-XXX.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /Users/erik/.ssh/known_hosts:1
debug2: bits set: 523/1024
debug1: ssh_rsa_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: SSH2_MSG_SERVICE_REQUEST sent
debug2: service_accept: ssh-userauth
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug2: key: erik-keypair.pem (0x0)
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Trying private key: erik-keypair.pem
debug1: read PEM private key done: type RSA
debug2: we sent a publickey packet, wait for reply
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
李四有人发现我做错了什么?
Rodney Quillo的答案很可能是正确的。我会通过说官方的Ubuntu发行版也有默认用户作为ubuntu来扩展它。
Rodney和Sarge都是正确的,因为有一个自定义的默认用户名。谢谢大家 – 2011-04-12 23:53:55
如果我没有弄错,你应该使用ec2-user而不是root。
使用$ ssh -v -v -i erik-keypair.pem的相同响应[email protected] – 2011-04-12 13:18:54
如果您使用alestic.com的ubuntu AMI,请使用Ubuntu的用户。 – 2011-04-12 13:49:43
我添加了这个答案,以防其他人有同样的问题。我需要我的私钥才能拥有.pem扩展名。没有扩展名导致我的问题。
您确定您的Amazon EC2实例是SUSE Linux吗?为什么您使用'root'用户?检查您创建的实例类型。上式EC2实例的
细节用户depnds
OS类型USENAME
亚马逊的Linux EC2用户 RHEL5 EC2用户/ EC2用户 Ubuntu的Ubuntu的 SUSE Linux根
进一步的细节在 http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
你确定你的Amazon EC2实例是SUSE Linux th蚂蚁为什么使用'root'用户。检查您创建的实例类型。用户depnds的类型EC2实例的
细节
操作系统类型---------- USENAME
- Linux的亚马逊EC2 ---------- -user
- RHEL5 ---------- EC2用户/ EC2用户
- Ubuntu的---------- ubuntu的
- SUSE Linux的------- --- root
进一步的细节在 http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AccessingInstancesLinux.html
我有完全相同的问题。我有一个EC2实例,我重启了它(由于AWS硬件问题),当实例回来时,我无法通过ssh连接到它,并且我得到与Erik相同的错误。任何想法?到目前为止,我必须创建一个新实例,将旧卷连接到它,将这些文件复制到实例并重新配置所有内容。整个过程非常烦人和昂贵(2个句子,而不是一个,快照,2个卷,而不是一个)。任何想法解决它? – 2012-06-13 21:37:19