DenyHosts is a security tool written in python that monitors server access logs to prevent brute force attacks on a virtual private server. The program works by banning IP addresses that exceed a certain number of failed login attempts.

1. Install DenyHosts via apt

sudo apt-get install denyhosts

2. Whitelist you IP Addresses
After you install DenyHosts, make sure to whitelist your own IP address. Skipping this step will put you at risk of locking yourself out of your own machine.

To insert you IP, open this file:

sudo nano /etc/hosts.allow

under the description, add in any IP addresses e.g. your IP so that you will not kicked out from the server. You can write each one on a separate line, using this format:

sshd: 12.34.45.678
sshd: 89.76.54.321

After making any changes, be sure to restart DenyHosts so that the new settings take effect on your virtual private server:

sudo /etc/init.d/denyhosts restart

3. Configure DenyHosts (Optional)
If you want to customize the behavior of DenyHosts on your VPS, you can make the changes within the DenyHost configuration file:

sudo nano /etc/denyhosts.conf

By zam

Related Post

Any Comments?

This site uses Akismet to reduce spam. Learn how your comment data is processed.