如何修复“ssh_exchange_identification:读取:对端重置连接”错误?

如何修复“ssh_exchange_identification:读取:对端重置连接”错误?

我无法使用我的电脑通过 ssh 连接到我的服务器,但我可以使用 termius 应用程序通过我的手机连接到此服务器。我已经检查了/etc/hosts.allow/etc/hosts.deny的 iptables,我也在谷歌上搜索过,似乎没有答案适合这个问题。我不知道如何解决它,这里是ssh -v 183.17.228.80输出

debug1: Connecting to 183.17.228.80 [183.17.228.80] port 22.
debug1: Connection established.=======================   
debug1: permanently_set_uid: 0/0   
debug1: SELinux support disabled  
debug1: key_load_public: No such file or directory    
debug1: identity file /root/.ssh/id_rsa type -1    
debug1: key_load_public: No such file or directory   
debug1: identity file /root/.ssh/id_rsa-cert type -1      
debug1: key_load_public: No such file or directory   
debug1: identity file /root/.ssh/id_dsa type -1   
debug1: key_load_public: No such file or directory   
debug1: identity file /root/.ssh/id_dsa-cert type -1   
debug1: key_load_public: No such file or directory   
debug1: identity file /root/.ssh/id_ecdsa type -1  
debug1: key_load_public: No such file or directory   
debug1: identity file /root/.ssh/id_ecdsa-cert type -1   
debug1: key_load_public: No such file or directory  
debug1: identity file /root/.ssh/id_ed25519 type -1   
debug1: key_load_public: No such file or directory  
debug1: identity file /root/.ssh/id_ed25519-cert type -1  
debug1: Enabling compatibility mode for protocol 2.0  
debug1: Local version string SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu2.2   
ssh_exchange_identification: read: Connection reset by peer

我可以 ping 通这个服务器,这是 telnet

telnet 183.17.228.29 22  
Trying 183.17.228.29...  
Connected to 183.17.228.29.  
Escape character is '^]'.                                                                 
Connection closed by foreign host.

答案1

只是重启服务器您想要 ssh 的那个。它对我有用,以前我也遇到过同样的问题。

答案2

这实际上意味着您的 IP 被服务器列入了黑名单。尝试将您的 IP 地址列入白名单以便能够登录。您可以查看 /etc/hosts 列表以查看您的服务器的 IP 地址是否已更改。

答案3

我遇到了同样的问题,但重新启动 sshd 守护进程后,我就可以连接到主机。

sudo systemctl restart sshd && systemctl status sshd

这只是一种临时的解决方法,直到您增加 MaxAuthTries 参数为止。

答案4

看来服务器上的 ssh 守护进程已挂起。你确定它正在运行吗?当你通过 telnet 连接到 ssh 时,你必须看到一个签名。类似于:

telnet unixhow.com 22
Trying 35.228.26.20...
Connected to unixhow.com.
Escape character is '^]'.
SSH-2.0-OpenSSH_7.6p1 Ubuntu-4ubuntu0.1

我从您的输出中看到,ssh 守护程序在服务器端没有响应。我建议通过 IP-KVM(或其他方式)连接到远程计算机并重新启动 sshd。

相关内容