security.frabs.net
All Guides

Logins · about 3 minutes

Limit SSH Password Tries

What This Means

SSH lets each connection try many passwords before it disconnects.

Why It Matters

Fewer tries per connection slows password guessing down and makes it easier to spot and block.

  1. 1

    See the current limit

    sshd -T | grep -i maxauthtries
    Terminal: See the current limit, on Ubuntu 24.04
  2. 2

    Set it to 3

    Settings in /etc/ssh/sshd_config.d/ are read first, and the first value SSH reads wins, so a file named 10-… beats the defaults and anything your host added (such as 50-cloud-init.conf).

    echo 'MaxAuthTries 3' > /etc/ssh/sshd_config.d/10-frabs-tries.conf
    Terminal: Set it to 3, on Ubuntu 24.04
  3. 3

    Check, reload and confirm

    sshd -t && systemctl reload ssh && sshd -T | grep -i maxauthtries
    Terminal: Check, reload and confirm, on Ubuntu 24.04

Check It’s Fixed

Run the security report again. This check should now pass.

More Logins Guides

Stop Root Logging In Over SSH With a PasswordTurn Off SSH Password LoginsRemove Extra Accounts With Root PowersLock Accounts With No Password