Interview Prep/Linux/Security, hardening and incident response

How do you protect a Linux server from SSH brute-force attempts flooding the logs?

BeginnerScenarioSecurity, hardening and incident response
Answer

Situation read → Reduce exposure, then rate-limit.

What I'd do →

  1. Disable password auth (brute force becomes pointless).
  2. Restrict SSH by source IP in the firewall or security group.
  3. Install fail2ban:
# /etc/fail2ban/jail.local
[sshd]
enabled = true
maxretry = 5
bantime = 1h

systemctl enable --now fail2ban; check fail2ban-client status sshd.

Why → Keys-only stops the attack from ever succeeding; fail2ban cuts the noise.

Interview tip → Say exposure reduction (no public SSH, use SSM/bastion) beats fail2ban.

All Linux questions Roadmap: Linux

More on Security, hardening and incident response