Verified and Tested 08/11/15


In this How-To, we will walk you through the install and configuration of DenyHost on a CentOS 6.7 Server. DenyHosts is used by many System Administrators to protect their servers/networks from Brute force attacks and hackers. It is simple and effective in getting the job done with little experience. Due to the simplicity of DenyHost and the ability to manually configure your rules it is widely used as an alternative to Fail2ban which is a bit more complicated to use and configure. We will now work on getting it installed on your server.


You need a CentOS 6.7 server that is configured with a static IP address. If you do not have a server already, fire up a cheap and reliable Cloud Server from Atlantic.Net.

Server Preparation

First, we need to make sure that your server is fully up-to-date by running the following command:

yum update

With the server up-to-date, we can continue and install DenyHost on CentOS 6.7.

Install DenyHost on CentOS 6.7

Download the EPEL repository with the following command:

sudo rpm -Uvh

Install the Deny Hosts package with the following:

sudo yum install denyhosts

We must make sure to allow your IP address to prevent yourself from being denied access. We do this editing the following:

nano /etc/hosts.allow

Add the following line all the way to the bottom of the description with your IP. In most cases, you can use this link to find your IP address.


Next we need to block everything by editing the following file:

nano /etc/hosts.deny

Add the following line all the way to the bottom of the description:

 sshd: ALL   **

Save your work and restart DenyHosts with the following command:

/etc/init.d/denyhosts restart

You can further configure any settings in the DenyHosts.conf file by going to the following and updating according to your preference.

nano /etc/denyhosts.conf

Congratulations! You have just installed DenyHosts on your CentOS 6.7 Server. Thank you for following along in this How-To! Check back with us for any new updates, and browse our full lineup of our SSD Cloud Hosting.