![ssh_exchange_identification:连接被远程主机关闭](https://linux22.com/image/29466/ssh_exchange_identification%EF%BC%9A%E8%BF%9E%E6%8E%A5%E8%A2%AB%E8%BF%9C%E7%A8%8B%E4%B8%BB%E6%9C%BA%E5%85%B3%E9%97%AD.png)
OpenSSH_5.9p1 Debian-5ubuntu1, OpenSSL 1.0.1 14 Mar 2012
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 19: Applying options for *
debug2: ssh_connect: needpriv 0
debug1: Connecting to 178.xxx.xxx.xxx [178.xxx.xxx.xxx] port 22.
debug1: Connection established.
debug1: identity file /home/orangetux/.ssh/id_rsa type 1
debug1: Checking blacklist file /usr/share/ssh/blacklist.RSA-2048
debug1: Checking blacklist file /etc/ssh/blacklist.RSA-2048
debug1: identity file /home/orangetux/.ssh/id_rsa-cert type -1
debug1: identity file /home/orangetux/.ssh/id_dsa type -1
debug1: identity file /home/orangetux/.ssh/id_dsa-cert type -1
debug1: identity file /home/orangetux/.ssh/id_ecdsa type -1
debug1: identity file /home/orangetux/.ssh/id_ecdsa-cert type -1
ssh_exchange_identification: Connection closed by remote host
通过管理面板,我可以访问日志,我看到:
Mar 8 20:32:10 vmi11458 sshd[2334]: Set /proc/self/oom_adj to 0
Mar 8 20:32:10 vmi11458 sshd[2334]: refused connect from 82.xxx.xxx.xxx (82.xxx.xxx.xxx)
我已停止 DenyHosts 服务。但我仍然无法登录。我该如何解决这个问题?
答案1
通过停止 denyhosts 服务,您可以防止在 中创建新条目/etc/hosts.deny
,但已存在的条目仍然存在。您需要手动从hosts.deny
文件夹中删除 IP。为了防止该IP被再次添加,需要在文件中将其列入白名单allowed-hosts
。
答案2
要调试此问题,请检查以下事项:
.ssh
请仔细检查您的目录的权限700
和.ssh/authorized_keys
文件的权限是否必须为600
.检查日志
/var/secure/logs
以了解连接关闭的原因。