Install and Configure DenyHosts

Step 1.Download the relevant rpm.

Step 2. Install the rpm:
# rpm -ivh DenyHosts-2.6-python2.3.noarch.rpm

Step 3. make a copy of default configuration file:
# cd /usr/share/denyhosts/
# cp denyhosts.cfg-dist denyhosts.cfg

Step 4. Edit the configuration file to suit your needs:
# vi denyhosts.cfg

Step 5. You can run DenyHosts by cron or as Daemon. preferred way is to run it as daemon. To run it as daemon, make a copy of its default daemon script
# cp daemon-control-dist daemon-control

Step 6. Set proper permissions for daemon script:
# chown root daemon-control
# chmod 700 daemon-control

Step 7. Start it:
# ./daemon-control start

Step 8. Make it run on startup:
# cd /etc/init.d
# ln -s /usr/share/denyhosts/daemon-control denyhosts
# chkconfig –add denyhosts

You can view its log and also view the hosts.deny file to find out how many hosts are denied: