Warning
Use a sudo-capable account, keep shell history for audit, and back up critical paths before changing boot, SSH, or package state.
What you will achieve
Automatically block IPs hammering SSH — simple jail config for small servers.
1) Install and enable fail2ban
sudo apt update
sudo apt install -y fail2ban
sudo systemctl enable --now fail2ban
2) Create SSH jail config
[sshd]
enabled = true
bantime = 1h
findtime = 10m
maxretry = 5
3) Check ban status
sudo fail2ban-client status
sudo fail2ban-client status sshd