【发布时间】:2016-09-19 15:30:11
【问题描述】:
看来我不是第一个为此苦苦挣扎的人。
直到现在,我通过 SSH 访问我的 EC2 实例都没有问题。到现在为止。
无论我做什么,都会收到权限被拒绝错误。我检查了我的 ec2 用户无数次,也检查了我的安全组参数。我的 IP 在入站规则中正确注册。
我尝试使用实例 DNS 和 IP。我使用 keygen -r 强制重新生成 keygen。斯蒂尔也一样。我的密钥对文件的权限为 0600。
这可能发生在实例重新启动后(不是停止/启动,来自 EC2 仪表板,而不是来自 shell)。我的实例在没有任何警报的情况下运行,并且我的网站正确显示。
我的 ssh 命令来了:
ssh -v -i "~/.ssh/namaste_3.pem" ubuntu@ec2-52-29-237-225.eu-central-1.compute.amazonaws.com
或
ssh -v -i "~/.ssh/keypair.pem" ubuntu@52.29.237.225
这是我的 ssh -v 输出:
OpenSSH_7.2p2 Ubuntu-4, OpenSSL 1.0.2g-fips 1 Mar 2016
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to 52.29.237.225 [52.29.237.225] port 22.
debug1: Connection established.
debug1: key_load_public: No such file or directory
debug1: identity file /home/brice/.ssh/namaste_3.pem type -1
debug1: key_load_public: No such file or directory
debug1: identity file /home/brice/.ssh/namaste_3.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.4 pat OpenSSH_6.6.1* compat 0x04000000
debug1: Authenticating to 52.29.237.225:22 as 'ubuntu'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256@libssh.org
debug1: kex: host key algorithm: ecdsa-sha2-nistp256
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ecdsa-sha2-nistp256 SHA256:yiGarcstgUfXZmop1URjMPa/pp1J5mak4Rsl6TWuAh4
debug1: Host '52.29.237.225' is known and matches the ECDSA host key.
debug1: Found key in /home/brice/.ssh/known_hosts:2
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: bleroux@fluksaqua.com
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/brice/.ssh/namaste_3.pem
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
有什么线索吗?我真的不想从头开始一个新实例......
【问题讨论】:
-
试一试:你能ssh到另一台机器吗?可能是askubuntu.com/questions/343060/… 的行(其中一台机器上的权限错误)
-
感谢您的回复。我没有另一个正在运行的实例。我从 aws 仪表板克隆了那个。嗯……那个没问题。
-
我仍然无法访问我的旧实例,我不明白为什么。我花了几个小时才站起来……尽管这仍然是测试版,但我将不得不提升我的备份策略……
标签: amazon-ec2 ssh-keys