AWS SSH连接错误:权限被拒绝(公钥) [英] AWS SSH connection error: Permission denied (publickey)

查看:1106
本文介绍了AWS SSH连接错误:权限被拒绝(公钥)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试着用SSH连接到我的EC2实例和即时通讯越来越疯狂。我已阅读这篇文章,并尝试了所有用户的组合:

<一个href="http://stackoverflow.com/questions/1454629/aws-ssh-access-permission-denied-publickey-issue">AWS ssh访问权限被拒绝(公钥)的问题

它仍然不是为我工作。任何想法,我缺少什么?

 罗伯特@ Ubuntu的:〜/键$的ssh -v -i EC2-键pair.pem ec2-user@ec2-54-72-242-0.eu-west- 1.compute.amazonaws.com
OpenSSH_6.6,OpenSSL的1.0.1f 2014年1月6日
DEBUG1:读取配置数据的/ etc / SSH / ssh_config中
DEBUG1:在/ etc / SSH / ssh_config中第19行:申请选择*
DEBUG1:连接到ec2-54-72-242-0.eu-west-1.compute.amazonaws.com [54.72.242.0]端口22。
DEBUG1:连接建立。
DEBUG1:标识文件EC2-键pair.pem型-1
DEBUG1:标识文件EC2-键pair.pem证书类型-1
DEBUG1:启用兼容模式协议2.0
DEBUG1:本地版本字符串SSH-2.0-OpenSSH_6.6p1 Ubuntu的2ubuntu1
DEBUG1:远程协议版本2.0,远程软件版本OpenSSH_6.2
DEBUG1:比赛:OpenSSH_6.2拍的OpenSSH * COMPAT 0x04000000
DEBUG1:SSH2_MSG_KEXINIT发
DEBUG1:收到SSH2_MSG_KEXINIT
DEBUG1:KEX:服务器 - &GT;客户AES128-CTR hmac-md5-etm@openssh.com无
DEBUG1:KEX:客户 - &GT;服务器AES128-CTR hmac-md5-etm@openssh.com无
DEBUG1:发送SSH2_MSG_KEX_ECDH_INIT
DEBUG1:期待SSH2_MSG_KEX_ECDH_REPLY
DEBUG1:服务器主机密钥:ECDSA E4:06:EE:A5:A5:D2:97:5F:0F:B7:06:5E:F2:B3:DA:26
DEBUG1:主机'ec2-54-72-242-0.eu-west-1.compute.amazonaws.com'是已知的和ECDSA主机密钥相匹配。
DEBUG1:在/home/roberto/.ssh/known_hosts:3找到关键
DEBUG1:ssh_ecdsa_verify:签名正确
DEBUG1:SSH2_MSG_NEWKEYS发
DEBUG1:期待SSH2_MSG_NEWKEYS
收到SSH2_MSG_NEWKEYS:DEBUG1
DEBUG1:由服务器不允许漫游
DEBUG1:SSH2_MSG_SERVICE_REQUEST SENT
DEBUG1:收到SSH2_MSG_SERVICE_ACCEPT
DEBUG1:身份验证,可以继续:公钥
DEBUG1:下一个身份验证方法:公钥
DEBUG1:尝试私钥:EC2-键pair.pem
DEBUG1:key_parse_private2:缺少开始标记
DEBUG1:读PEM私钥进行:输入RSA
DEBUG1:身份验证,可以继续:公钥
DEBUG1:没有更多的认证方法去尝试。
权限被拒绝(公钥)。

更新:
 

据@aldanux建议:

 罗伯特@ Ubuntu的:〜/键$的ssh-凯基-R 54.72.242.0
#主机54.72.242.0发现:4号线式ECDSA
/home/roberto/.ssh/known_hosts更新。
原来的内容保留为/home/roberto/.ssh/known_hosts.old
罗伯特@ Ubuntu的:〜/键$的ssh -i EC2-键pair.pem ec2-user@ec2-54-72-242-0.eu-west-1.compute.amazonaws.com
警告:永久增加了ECDSA主机密钥的IP地址五四.72.242.0已知主机列表。
权限被拒绝(公钥)。
 

解决方案

试试这个步骤:

 的ssh-凯基-R 54.72.242.0

sudo的文件模式600 EC2键,pair.pem
 

然后:

 的ssh -i EC2-键pair.pem ec2-user@ec2-54-72-242-0.eu-west-1.compute.amazonaws.com
 

Im trying to connect to my EC2 instance with SSH and Iḿ getting crazy. I have read this post and tried all user combinations:

AWS ssh access 'Permission denied (publickey)' issue

Its still not working for me. Any idea what am I missing?

  roberto@ubuntu:~/keys$ ssh -v -i ec2-key-pair.pem ec2-user@ec2-54-72-242-0.eu-west-1.compute.amazonaws.com
OpenSSH_6.6, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-54-72-242-0.eu-west-1.compute.amazonaws.com [54.72.242.0] port 22.
debug1: Connection established.
debug1: identity file ec2-key-pair.pem type -1
debug1: identity file ec2-key-pair.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6p1 Ubuntu-2ubuntu1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.2
debug1: match: OpenSSH_6.2 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA e4:06:ee:a5:a5:d2:97:5f:0f:b7:06:5e:f2:b3:da:26
debug1: Host 'ec2-54-72-242-0.eu-west-1.compute.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/roberto/.ssh/known_hosts:3
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: Trying private key: ec2-key-pair.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

UPDATE: 

According to @aldanux suggestions:

    roberto@ubuntu:~/keys$ ssh-keygen -R 54.72.242.0
# Host 54.72.242.0 found: line 4 type ECDSA
/home/roberto/.ssh/known_hosts updated.
Original contents retained as /home/roberto/.ssh/known_hosts.old
roberto@ubuntu:~/keys$ ssh -i ec2-key-pair.pem ec2-user@ec2-54-72-242-0.eu-west-1.compute.amazonaws.com
Warning: Permanently added the ECDSA host key for IP address '54.72.242.0' to the list of known hosts.
Permission denied (publickey).

解决方案

Try this steps:

ssh-keygen -R 54.72.242.0

sudo chmod 600 ec2-key-pair.pem

and then:

ssh -i ec2-key-pair.pem ec2-user@ec2-54-72-242-0.eu-west-1.compute.amazonaws.com

这篇关于AWS SSH连接错误:权限被拒绝(公钥)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆