繁体   English   中英

无法使用SSH连接到AWS EC2

[英]Can't connect to aws EC2 using SSH

我有一个已经运行了几个月且没有任何问题的AWS EC2实例。

今天,当我想使用ssh访问它时:

ssh -i“ DRUID_PROD_NEW.pem” ec2-user@eX.XXxcompute-1.amazonaws.com

我收到一个

权限被拒绝(公钥)。

昨天效果很好,但现在我无法连接。 在过去的几个月中,我没有在服务器上进行任何更改。

我在二月份遇到了完全相同的问题。 我必须重新安装一个实例,然后复制所有内容。 这是一项艰巨的工作,如果这是正常的话,我将完全辞职。

感谢您的帮助。

OpenSSH_6.6.1, OpenSSL 1.0.1k-fips 8 Jan 2015
debug1: Reading configuration data /home/kim/.ssh/config
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 20: Applying options for *
debug1: Connecting to ec2-XX-XX-XX-XX.compute-1.amazonaws.com   [XX.XX.XX.XX] port 22.
debug1: Connection established.
debug1: identity file DRUID_PROD_NEW.pem type -1
debug1: identity file DRUID_PROD_NEW.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1
debug1: match: OpenSSH_6.6.1 pat OpenSSH_6.6.1* 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 XX:XX:XX:XX:2e:3c:c7:56:94:6f:97:56:68:9d:e0:06 [MD5]
debug1: Host 'ec2-XX-XX-XX-XX.compute-1.amazonaws.com' is known and matches the ECDSA host key.
debug1: Found key in /home/kim/.ssh/known_hosts:45
debug1: ssh_ecdsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
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: DRUID_PROD_NEW.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).

谢谢金

我发现了问题所在。

几周前,我将ec2-user目录更改为可读组。 显然,这使机器无法访问。 我完全忘记了这一点,今天,当我需要访问计算机时,我收到了臭名昭著的错误。

因此,将ec2-user主目录的权限更改回755可解决该问题。

感谢您抽出宝贵的时间来帮助我摆脱这种情况。

暂无
暂无

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

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