如何修復「ssh_exchange_identification:讀取:連線由對等方重設」錯誤?

如何修復「ssh_exchange_identification:讀取:連線由對等方重設」錯誤?

我無法使用我的電腦透過 ssh 連接到我的伺服器,但我可以使用 termius 應用程式透過我的手機連接到該伺服器。我檢查了/etc/hosts.allow/etc/hosts.deny的 iptables,並且還搜尋了 google,似乎沒有答案適合這個問題。我不知道如何解決它,這是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。

相關內容