我多次访问服务器。而且我可以完美连接。今天晚上我想再次连接它给我一个错误。
-> % ssh ubuntu@pkp-alm.lib.sfu.ca -v
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 pkp-alm.lib.sfu.ca [52.4.177.245] port 22.
debug1: Connection established.
debug1: identity file /home/guinsly/.ssh/id_rsa type 1
debug1: identity file /home/guinsly/.ssh/id_rsa-cert type -1
debug1: identity file /home/guinsly/.ssh/id_dsa type -1
debug1: identity file /home/guinsly/.ssh/id_dsa-cert type -1
debug1: identity file /home/guinsly/.ssh/id_ecdsa type -1
debug1: identity file /home/guinsly/.ssh/id_ecdsa-cert type -1
debug1: identity file /home/guinsly/.ssh/id_ed25519 type -1
debug1: identity file /home/guinsly/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
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_6.6.1* compat 0x04000000
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA c6:7c:32:1c:70:96:6e:ea:c0:84:96:79:3a:6c:06:bb
debug1: Host 'pkp-alm.lib.sfu.ca' is known and matches the ECDSA host key.
debug1: Found key in /home/guinsly/.ssh/known_hosts:21
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/guinsly/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: guinslym@gmail.com
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: guinsly@guinsly-ThinkPad-L430
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: guinslym@gmail.com
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/guinsly/.ssh/id_dsa
debug1: Trying private key: /home/guinsly/.ssh/id_ecdsa
debug1: Trying private key: /home/guinsly/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).
我的公钥名为lagotto_rsa.pub
,它是默认情况下应该使用的公钥,但现在它似乎无法找到公钥
ssh -i ~/.ssh/lagotto_rsa.pub ubuntu@pkp-alm.lib.sfu.ca -v
还给了我Permission denied (publickey).
-> % ssh -i ~/.ssh/lagotto_rsa.pub ubuntu@pkp-alm.lib.sfu.ca -v
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 pkp-alm.lib.sfu.ca [52.4.177.245] port 22.
debug1: Connection established.
debug1: identity file /home/guinsly/.ssh/lagotto_rsa.pub type 1
debug1: identity file /home/guinsly/.ssh/lagotto_rsa.pub-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.6.1p1 Ubuntu-2ubuntu2.3
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_6.6.1* compat 0x04000000
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: sending SSH2_MSG_KEX_ECDH_INIT
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ECDSA c6:7c:32:1c:70:96:6e:ea:c0:84:96:79:3a:6c:06:bb
debug1: Host 'pkp-alm.lib.sfu.ca' is known and matches the ECDSA host key.
debug1: Found key in /home/guinsly/.ssh/known_hosts:21
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
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /home/guinsly/.ssh/lagotto_rsa.pub
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: guinslym@gmail.com
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: guinsly@guinsly-ThinkPad-L430
debug1: Authentications that can continue: publickey
debug1: Offering RSA public key: guinsly@guinsly-ThinkPad-L430
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).
我也用私钥试了一下。我想知道我的本地机器上有什么变化,我无法再访问遥控器了
答案 0 :(得分:2)
它不是你的遥控器,而是你的服务器有问题。仅当您更改了后端的权限时才会发生此错误。这是一个真正令人讨厌的错误,我只能解决它,因为我的网站托管在数字海洋上,他们给你控制台访问权限。所以只有这样才有可能。客户端无能为力。我问过一个关于这个的问题,如果可以的话,请问ubuntu检查该链接。否则请告诉我
答案 1 :(得分:1)
如果您可以通过任何其他方式连接到服务器,请检查~/.ssh/
文件夹和~/ssh/authorized_keys
文件的权限。它们应分别设置为700
和600
。
您还可以查看/var/log/auth.log
文件,了解尝试登录时会发生什么。如果您的系统有systemd
,则可以使用sudo journalctl -u sshd
或sudo journalctl
获取更多信息。