方法一
背景
连接远程服务器发生了以下的错误
ssh_exchange_identification: read: Connection reset
我想应该是我当前的 IP 地址被 DenyHosts 加入了黑名单
本来想只要将当前的 ip 地址在黑名单中去掉就可以了
没想到事实并不是如此,为此还查资料花费了一点功夫
现记录下来
注意 :
DenyHosts会读取多个记录确保没有漏网之鱼,清空/var/log/secure和/etc/hosts.deny并不能完美解锁自己的IP, 很快就会被DenyHosts重新锁定. 这也是DenyHosts强大的地方.
解决
停用 DenyHosts : systemctl stop denyhosts.service
删除黑名单中当前的ip地址: vim /etc/hosts.deny
进入 /var/lib/denyhosts
-rw-r--r-- 1 root root 39 2月 16 2015 allowed-hosts
-rw-r--r-- 1 root root 71451 7月 19 10:58 hosts
-rw-r--r-- 1 root root 71270 7月 19 10:58 hosts-restricted
-rw-r--r-- 1 root root 71433 7月 19 10:58 hosts-root
-rw-r--r-- 1 root root 71280 7月 19 10:58 hosts-valid
-rw-r--r-- 1 root root 105 7月 19 10:58 offset
-rw-r--r-- 1 root root 0 7月 19 10:58 suspicious-logins
-rw-r--r-- 1 root roo