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 →
- Disable password auth (brute force becomes pointless).
- Restrict SSH by source IP in the firewall or security group.
- 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.
More on Security, hardening and incident response
Monitoring shows a web server making outbound connections to an unknown IP on port 4444 at 2 AM. You suspect it is compromised. What do you do?AdvancedAfter the compromise you need to find how the attacker got in. Where do you look?AdvancedYour CISO asks you to harden a fresh Linux server baseline. What's on your list?IntermediateA developer says "SELinux keeps breaking my app, can we just disable it?" How do you respond and what do you do?IntermediateYou need to know when anyone modifies `/etc/sudoers`, `/etc/passwd` or SSH config. How?IntermediateA critical OpenSSL CVE is announced. How do you find and patch affected servers quickly?Intermediate