Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

yesterday i fail to login to my server because of bad password three times. Than no one from my IP can log to the system.

how to unlock it and how to set up rule like that? and other rule like if someone fail to login x time than lock that account.

ps : my server running with centos OS.

share|improve this question
are you using fail2ban ? – Sirex Mar 31 '11 at 13:01
You describe two different scenarios in the above question: that three bad attempts lock further login attempts from the source IP, and that three bad attempts lock further login attempts to that account. Which do you want to do? Plus, are we talking ssh logins only, or are you looking for a more generally-valid technique? – MadHatter Mar 31 '11 at 13:02
yes. its ssh login – Jeg Bagus Mar 31 '11 at 13:06
up vote 1 down vote accepted

Login to your CentOS Server from Different ISP IP:

Flush all current rules in IPTables:

iptables -F

Then, install CSF:

yum -y install perl-libwww-perl && \
wget && \
tar -xzf csf.tgz && \
cd csf && \

Then open /etc/csf/csf.conf

Change the value of TESTING to 0 from 1

So it should be like this:


Then confirm the value of LF_DAEMON with 1

So it should be like this:


Then change the value of LF_SSHD [Enable login failure detection of sshd connections]


/etc/init.d/csf restart
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.