【发布时间】:2016-08-31 04:15:04
【问题描述】:
您好,我的 AWS EC2 公钥突然被拒绝了。
我已经根据实例检查了密钥,并且我使用了正确的密钥。
我检查了端口 22 是否可以通过我的安全组访问,这看起来不错。
我没有对 aws 进行任何更改,并且我在实例上的 Web 服务器工作正常,所以我知道该实例可以连接。
有没有可能我的钥匙被人篡改了。
这是我用来访问我的 debian 实例的命令,到目前为止它一直“sshing”很好。
ssh -o "ServerAliveInterval 180" -i key.pem admin@xx.xx.xx.xxx
非常感谢何塞
编辑
这里是详细的输出:
$ ssh -v -o "ServerAliveInterval 180" -i /Users/Jose/Workspace/build/prod-key.pem admin@52.51.xx.14
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug1: Connecting to 52.51.xx.14 [52.51.xx.14] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Jose/Workspace/build/prod-key.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/Jose/Workspace/build/prod-key.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.0p1 Debian-4+deb7u4
debug1: match: OpenSSH_6.0p1 Debian-4+deb7u4 pat OpenSSH* compat 0x04000000
debug1: Authenticating to 52.51.xx.14:22 as 'admin'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr umac-64@openssh.com none
debug1: kex: client->server aes128-ctr umac-64@openssh.com none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:ZKUAyMwCyvgy42SSYy8+hNsYKz13m0u0Uwp1RvXSAac
debug1: Host '52.51.xx.14' is known and matches the ECDSA host key.
debug1: Found key in /Users/Jose/.ssh/known_hosts:2
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: /Users/Jose/Workspace/build/prod-key.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
【问题讨论】:
-
您能否提供带有错误的详细输出?
-
你检查你使用的IP地址是否正确?进入您的实例列表并选择您要连接的实例,然后单击连接按钮,您可以在其中查看示例,例如 ssh -i "key.pem" ubuntu@xxxx.amazonaws.com
-
真让我头疼,这是在生产中,没有人拥有我们的密钥,而且我一直看到 AWS 做这样的事情。始终与 S3 相关。当我们有成千上万的用户时,超级烦人。
标签: ssh amazon-ec2 public-key