无法登录 Amazon EC2 计算服务器

无法登录 Amazon EC2 计算服务器

我无法登录到 EC2 服务器。

这是连接尝试的日志:

$ ssh -v -i ec2-key-incoleg-x002.pem [email protected]
OpenSSH_5.6p1, OpenSSL 0.9.8p 16 Nov 2010
debug1: Reading configuration data /home/gvaish/.ssh/config
debug1: Applying options for *
debug1: Connecting to ec2-50-16-0-207.compute-1.amazonaws.com [50.16.0.207] port 22.
debug1: Connection established.
debug1: identity file ec2-key-incoleg-x002.pem type -1
debug1: identity file ec2-key-incoleg-x002.pem-cert type -1
debug1: identity file /home/gvaish/.ssh/id_rsa type -1
debug1: identity file /home/gvaish/.ssh/id_rsa-cert type -1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.6
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5 none
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
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host 'ec2-50-16-0-207.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/gvaish/.ssh/known_hosts:8
debug1: ssh_rsa_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-incoleg-x002.pem
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/gvaish/.ssh/id_rsa
debug1: No more authentication methods to try.
Permission denied (publickey).

可能的原因是什么?我该如何解决这个问题?

答案1

看起来您使用了错误的公钥。您确定您拥有正确的公钥或服务器上的私钥接受您使用的公钥吗?

每个 EC2 实例都需要正确的质子泵并登录用户急性心肌梗死您正在使用。此外,AMI 默认不允许远程 root 登录。唯一能够远程登录的用户是 ec2-user。对于 Ubuntu,默认用户是 ubuntu。一些其他 AMI(如 CentOS)允许您以 root 身份登录。

相关内容