我有一台 RHEL 6.8 x86_64 服务器,其 SSH 服务器长期存在问题。它安装了 openssh-5.3p1-118.1.el6_8.x86_64。每次尝试连接 SSH/SFTP 时,服务器都会返回错误:
ssh_exchange_identification: read: Connection reset by peer
这种情况并非每次都会发生,因此很难调试。当这种情况发生时,即使有更详细的日志记录,SSH 日志中也不会显示任何有关所发生情况的信息。我注意到的是,我必须每隔几周重新启动 sshd,否则它会完全停止工作。
您能就如何诊断和修复此问题提供任何建议吗?
ssh -vvv
更新(2016 年 8 月 27 日):以下是连接失败的结果:
timothys-MacBook-Pro:~ tbutler$ ssh -vvv tbutler@myserver
OpenSSH_6.9p1, LibreSSL 2.1.8
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 21: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to myserver [xx.xx.xx.xx] port 22.
debug1: Connection established.
debug1: identity file /Users/tbutler/.ssh/id_rsa type 1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_rsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_dsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /Users/tbutler/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_6.9
ssh_exchange_identification: read: Connection reset by peer
我尝试再次登录,结果还是一样。最后,在第三次尝试时,我终于能够连接,结果调试信息看起来差不多,但随后继续:
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000