This howto will show you how to install and configure Denyhosts on your server or desktop system to help further prevent unwanted attacks or access to your systems.

Applicable to Centos Versions:

  • Centos 5.x
  • Centos 6.x


Explanation of requirements.

  1. Root access to the machine(s) in question.
  2. A cup of fine Central American coffee

Doing the Work

Basic description of what will be done and what is expected.

  1. First, I suggest you implement some or all of the security measures outlined in zcats’ well written howto on securing SSH. Click the link below to be redirected:
  2. Installation of Denyhosts:
  3. Configuration of Denyhosts:
  4. Starting the service and marking it to run on each system reboot:
  5. Allowing yourself unrestricted access with the allowed-hosts and hosts.allow lists:
  6. Configuration file sample for Denyhosts:

Troubleshooting / How To Test

Having trouble with anything above? Here’s some hints that might help.

  1. “Command not found.” message even though you’re logged in as the “root” user?:
  2. Commands used were: yum, vi, service, chkconfig and su.

Common Problems & Fixes

Problems getting proper answers in IRC or forums? Read the outline here for tips on getting better answers by asking smarter questions.

More Information

Additional information or notes.


We test this stuff on our own machines, really we do. But you may run into problems, if you do, come to #centoshelp on

Added Reading

Last Modified: 14 Dec, 2011 at 02:08:09