SSH 连接错误:ssh_exchange_identification:读取:对等方重置连接

Sen*_*l G 26 linux ssh

当我尝试通过 SSH 连接到服务器时,出现以下错误,

[root@oneeighty ~]# ssh -vvv -p 443 root@xxx.xxx.xxx
OpenSSH_4.3p2, OpenSSL 0.9.8e-fips-rhel5 01 Jul 2008
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to xxx.xxx.xxx [IP] port 443.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: identity file /root/.ssh/identity type -1
debug1: identity file /root/.ssh/id_rsa type -1
debug1: identity file /root/.ssh/id_dsa type -1
debug1: loaded 3 keys
ssh_exchange_identification: read: Connection reset by peer
Run Code Online (Sandbox Code Playgroud)

我已经检查了服务器和客户端上的 SSH 配置,没有问题。

重新启动服务器上的 SSH 服务,然后重新启动服务器/客户端,但问题没有解决。

vag*_*wal 27

这可能是许多事情的结果。

您可以快速尝试的几件事如下,

  • 在 /etc/hosts.deny 中查找任何条目,例如 sshd: ALL
  • 也许,添加sshd: ALL/etc/hosts.allow

  • 您的 SSHD 的主机密钥可能已损坏。它们存在于 /etc/ssh/ 目录中。您可以删除它们并重新启动 sshd,它会重新生成它们。如果出现错误,请使用以下命令

    $ ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key
    $ ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key
    $ ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key
    $ /etc/init.d/sshd start
    
    Run Code Online (Sandbox Code Playgroud)


小智 1

检查您尝试连接的服务器上的 allowed.hosts 以及它正在运行的任何 iptables 规则。