I use CentOS 7 and would like to know if it is possible to block login via ssh (sshd) for a certain period of time after a certain amount of attempts.

EXAMPLE: After 3 wrong attempts the login is blocked for 15 minutes.

Thanks! =D

  • I have no experience with this, but it looks like it may be available out of the box: tecmint.com/….
    – chepner
    Commented Jan 17, 2020 at 14:32
  • 2
    Worth a look at fail2ban, see digitalocean.com/community/tutorials/…, this would mean you can block all incoming ssh for a period of time.
    – steve
    Commented Jan 17, 2020 at 15:17

2 Answers 2


As the comment above said, fail2ban should be worth looking at. It prevents bruteforce attempts and supports whitelisting, so it should fit to your criteria.


Take a look at sshguard, it will monitor the sshd logs and add an iptables rule to block connections from the ip address trying to log in for a set interval.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .