CentOS如何移除被hostsdeny限制访问的IP地址

Step # 1: Stop DenyHosts

1
# /etc/init.d/denyhosts stop

Step # 2: Remove Your IP From /etc/hosts.deny

1
# vi /etc/hosts.deny

Delete your IP address. Save and close the file.

Step # 3: Remove Your IP From /usr/share/denyhosts/data Directory

1
2
# cd /var/lib/denyhosts
# cd /usr/share/denyhosts/data

You need to edit the following files using vi and remove the lines containing the IP address. Save the file.

1
2
3
4
5
hosts
hosts-restricted
hosts-root
hosts-valid
users-hosts

If you’ve static IP address add to allowed-hosts file. Any IP address that appears in this file will not be blocked by default (consider this as a whilelist):

1
# echo '1.2.3.4' >> allowed-hosts

Step # 4: Start DenyHosts

1
# /etc/init.d/denyhosts start