即使我已经把我的public_key放在那里,我也无法访问我的远程服务器。这是日志,当我做了一个" ssh -v ubuntu@website.com":
ssh -v ubuntu@plumbersserver.net
OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011
debug1: Reading configuration data /Users/kevinyee/.ssh/config
debug1: Reading configuration data /etc/ssh_config
debug1: /etc/ssh_config line 20: Applying options for *
debug1: Connecting to plumbersserver.net [::1] port 22.
debug1: connect to address ::1 port 22: Connection refused
debug1: Connecting to plumbersserver.net [54.206.17.8] port 22.
debug1: Connection established.
debug1: identity file /Users/kevinyee/.ssh/id_rsa type 1
debug1: identity file /Users/kevinyee/.ssh/id_rsa-cert type -1
debug1: identity file /Users/kevinyee/.ssh/id_dsa type -1
debug1: identity file /Users/kevinyee/.ssh/id_dsa-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.2
debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-2ubuntu2
debug1: match: OpenSSH_6.6.1p1 Ubuntu-2ubuntu2 pat OpenSSH*
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes128-ctr hmac-md5-etm@openssh.com none
debug1: kex: client->server aes128-ctr hmac-md5-etm@openssh.com 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: Server host key: RSA cf:a8:01:57:1f:f6:3f:9e:6a:2a:8f:e4:0c:ce:8d:a3
debug1: Host 'plumbersserver.net' is known and matches the RSA host key.
debug1: Found key in /Users/kevinyee/.ssh/known_hosts:1
debug1: ssh_rsa_verify: signature correct
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: Offering RSA public key: /Users/kevinyee/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /Users/kevinyee/.ssh/id_dsa
debug1: No more authentication methods to try.
Permission denied (publickey).
请帮忙。我不知道自己做错了什么。
答案 0 :(得分:0)
尝试以下问题排查步骤:
/home/ec2-user/.ssh
chmod 0600 /home/ec2-user/.ssh/your_public_key
-i
标志进行连接时,请确保使用正确的私钥。 ssh -i ~/.ssh/your_private_key.pem ec2-user@website.com
如果您无法连接到该实例,以验证步骤1&amp;在上面的图2中,然后停止实例,分离根卷,并将其附加并挂载到可用实例。
答案 1 :(得分:0)
由于您以'ubuntu'用户身份登录,因此在ec2实例中,您的公钥应附加到文件:/home/ubuntu/.ssh/authorized_keys。如果该文件不存在,请使用您的公钥内容创建该文件,并确保将文件权限设置为600.