sudo sed -i 's/^#MaxAuthTries.*/MaxAuthTries 3/' /etc/ssh/sshd_config

Category: VPS Management

sudo sed -i 's/^#MaxAuthTries.*/MaxAuthTries 3/' /etc/ssh/sshd_config

Limit SSH authentication attempts to three

MaxAuthTries 3 cuts the number of failed auth attempts before the connection is dropped, slowing brute-force guessing at the daemon level (fail2ban handles repeat offenders at the firewall). Each attempt can also be a key offer, so generous key agents can hit the limit. Re-test after applying.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.