How To Install DenyHosts on CentOS 6

About DenyHosts

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


Step One—Install Deny Hosts

We need to use a repository to install Deny Hosts on CentOS.

sudo rpm -Uvh http://mirror.metrocast.net/fedora/epel/6/i386/epel-release-6-8.noarch.rpm
sudo yum install denyhosts

Once the program has finished downloading to the VPS, denyhosts is installed and configured.


Step Two—Whitelist 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 Virtual Private Server or Dedicated Server.

Open up the list of allowed hosts:

nano /etc/hosts.allow

Under the description, add in any IP addresses that cannot afford to be banned from the server; you can write each one on a separate line, using this format (replace the IP below with your IP in the example below):

sshd: 12.34.45.678

After making any changes, be sure to restart DenyHosts so that the new settings take effect on your Virtual Private Server or Dedicated Server:

/etc/init.d/denyhosts restart


Step Three—(Optional) Configure DenyHosts

DenyHosts is ready use as soon as the installation is over.

However if you want to customize the behavior of DenyHosts on your server, you can make the changes within the DenyHost configuration file:

nano /etc/denyhosts.conf


  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

Related Articles

A Basic MySQL Tutorial

About MySQL MySQL is an open source database management software that helps users store,...

How To Configure vsftpd to Use SSL/TLS on a CentOS server

Introduction Warning: FTP is insecure! Consider using SFTP instead of FTP. FTP, or file...

How To Protect SSH with fail2ban on CentOS 6

About Fail2Ban Servers do not exist in isolation, and those servers with only the most basic SSH...

How To Set Up vsftpd on CentOS 6

About vsftpd Warning: FTP is inherently insecure. If you must use FTP, consider securing your...

How To Use SFTP to Securely Transfer Files with a Remote Server

What is SFTP? FTP, or "File Transfer Protocol" is a popular method of transferring files between...