2015-11-20 221 views
-1

我多次访问服务器。我可以完美地连接。今天晚上我想再次连接它给我一个错误。ssh密钥权限在多次尝试后被拒绝

-> % ssh [email protected] -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 [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 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: [email protected] 
debug1: Authentications that can continue: publickey 
debug1: Offering RSA public key: [email protected] 
debug1: Authentications that can continue: publickey 
debug1: Offering RSA public key: [email protected] 
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 [email protected] -v 

给我也Permission denied (publickey).

-> % ssh -i ~/.ssh/lagotto_rsa.pub [email protected] -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 [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 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: [email protected] 
debug1: Authentications that can continue: publickey 
debug1: Offering RSA public key: [email protected] 
debug1: Authentications that can continue: publickey 
debug1: Offering RSA public key: [email protected] 
debug1: Authentications that can continue: publickey 
debug1: No more authentication methods to try. 
Permission denied (publickey). 

我也用私钥试了一下。我想知道我的本地机器发生了什么变化,我无法访问远程了

+0

你的问题是[离线](http://stackoverflow.com/help/on-topic)在这里。 –

回答

2

这不是你的远程,但你的服务器有问题。只有当您在后端更改权限时才会发生此错误。这是一个真正令人讨厌的错误,我只能解决它,因为我的网站托管在数字海洋上,并且它们可以让您访问控制台。所以这是唯一可能的,因为这一点。客户端无法做到这一点。如果可以的话,我问了一个关于这个问题的问题。否则让我知道

+0

[链接](http://askubuntu.com/questions/698101/ssh-exchange-identification-read-connection-reset-by-peer-error)仔细阅读评论部分,你会发现你的答案 –

+0

谢谢我将检查AWS是否有控制台访问,如DO –

+0

很高兴我可以帮助:) –

1

如果您可以任何其他方式连接到您的服务器,请检查~/.ssh/文件夹和~/ssh/authorized_keys文件的权限。它们应分别设置为700600

您还可以检查/var/log/auth.log文件以查看尝试登录时会发生什么。如果您的系统有systemd,您可以通过sudo journalctl -u sshdsudo journalctl获取更多信息。

+0

奇怪在我的本地我没有'authorized_keys'。 'chmod:can not access'。〜/ ssh/authorized_keys':没有这样的文件或目录' –

+0

我正在谈论的'authorized_keys'文件位于你的服务器上,而不是你的本地机器上。 – jeremija

+0

好的谢谢...晚上会很长:)我必须找到一种方法来访问它 –