我正在尝试从 Linux Mint 计算机通过 ssh 连接到我的 RHEL EC2 实例,当我运行以下命令时:
ssh ec2-user@SERVER_IP_ADDRESS
我收到此错误:
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
为了获取更多信息,我添加了 -v 标志,并得到了以下输出:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /home/user1/.ssh/config
debug1: /home/user1/.ssh/config line 1: Applying options for SERVER_IP_ADDRESS
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to SERVER_IP_ADDRESS [SERVER_IP_ADDRESS] port 22.
debug1: Connection established.
debug1: identity file /home/user1/Desktop/MyKeyPair.pem type -1
debug1: identity file /home/user1/Desktop/MyKeyPair.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.4
debug1: match: OpenSSH_6.4 pat OpenSSH* compat 0x04000000
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr [email protected] none
debug1: kex: client->server aes128-ctr [email protected] none
debug1: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA 7d:1a:81:3e:c8:df:be:e8:f2:7c:3f:46:24:cc:9d:95
debug1: Host 'SERVER_IP_ADDRESS' is known and matches the ECDSA host key.
debug1: Found key in /home/user1/.ssh/known_hosts:2
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,gssapi-keyex,gssapi-with-mic
debug1: Next authentication method: publickey
debug1: Offering RSA public key: EMAIL_ADDRESS
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: Trying private key: /home/user1/Desktop/MyKeyPair.pem
debug1: key_parse_private2: missing begin marker
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey,gssapi-keyex,gssapi-with-mic
debug1: No more authentication methods to try.
Permission denied (publickey,gssapi-keyex,gssapi-with-mic).
如何才能成功连接到我的 EC2 实例?
答案1
madeddie 在他们的最后一条评论中给了我一个答案:停止实例,分离 EBS 卷,然后将 EBS 卷附加到另一个实例。
答案2
您需要指定密钥(文件)的完整路径,包括文件名,即(C:{密钥所在的目录}:{keyname.pem}
错误:E:\360Pan\MySync\360Pan\CorePlay\PyWeb\AmazonAWSMyweb建站门户网站\ssh登录密钥\123.pem
右键:D:\360Pan\MySync\360Pan\CorePlay\PyWeb\AmazonAWSMyweb建站门户网站\ssh登录密钥\123.pem