DenyHosts: Remove / Delete an IP address

If you need to remove or delete an IP address from the DenyHosts blacklist, you can follow these steps:

  1. Log in to your server as root.
  2. Open the DenyHosts configuration file using a text editor:
vi /etc/hosts.deny
  1. Locate the line that contains the IP address you want to remove.
  2. Delete the line that contains the IP address.
  3. Save the changes to the file and exit the editor.
  4. Run the DenyHosts script to update the internal DenyHosts database:
/usr/share/denyhosts/daemon-control stop
/usr/share/denyhosts/daemon-control start

This will stop and then start the DenyHosts daemon to update the internal database with the changes made to the hosts.deny file.

  1. Check that the IP address has been removed by running the following command:
grep <IP_ADDRESS> /etc/hosts.deny

If the IP address has been successfully removed, the command will not return any output.

Note that if you have DenyHosts configured to block IP addresses in your firewall, you may also need to remove the IP address from your firewall rules.

Leave a Comment