我正在尝试登录到亚马逊上的实例,我的“.pem”文件有 600 个权限:
ssh -v -i FTPServer.pem [email protected]
我尝试了所有可能的用户“root/ubuntu/ec2-user..”我总是收到以下信息:
OpenSSH_6.6.1, OpenSSL 1.0.1f 6 Jan 2014
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug1: Connecting to ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com [xx.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file FTPServer.pem type -1
debug1: identity file FTPServer.pem-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-8
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1p1 Debian-6ubuntu2
debug1: match: OpenSSH_5.1p1 Debian-6ubuntu2 pat OpenSSH_5* compat 0x0c000000
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<3072<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: Server host key: RSA 0f:ad:a5:01:e1:75:82:fa:54:bd:56:53:34:d9:7e:6b
debug1: Host 'ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com' is known and matches the RSA host key.
debug1: Found key in /home/myhome/.ssh/known_hosts:6
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: Offering RSA public key: Downloads/FTPServer.pem
debug1: Authentications that can continue: publickey
debug1: Trying private key: FTPServer.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).
除非您在创建时提供了自定义用户列表,否则默认的“ubuntu”用户应该仍然存在,并且 EC2 密钥被放置在该用户上,就像典型的配置一样。
为了使其适用于其他用户,您需要从中获取行
/home/ubuntu/.ssh/authorized_keys
并将它们放入文件/home/$USER/.ssh/authorized_keys
中($USER
您专门尝试使用该密钥的用户名在哪里)。不过,根据您的评论,这不是您的 EC2 实例,您只是得到了
.pem
没有实际登录说明的信息。您需要联系管理员(设置 EC2 实例的人)并请求登录说明,并指示他们验证他们想要的用户的主目录文件中的公钥.pem
是否可用.ssh/authorized_keys
你登录为。这个问题是因为我使用了错误的 .pem 文件,然后我在亚马逊实例上作为默认用户“ubuntu”成功连接。