How to Respond to an Active SSH Brute‑Force Attack on WHM
Learn how to detect, contain, and harden SSH brute‑force attacks on Indian WHM/cPanel servers with step‑by‑step guidance for AlmaLinux/RHEL and Debian/Ubuntu.
4 min read
Running a WHM/cPanel server in India puts you in charge of protecting many websites, databases, and email accounts. A frequent threat is an SSH brute‑force attack, where bots try thousands of username/password pairs to gain shell access. If the attack succeeds, the attacker can compromise the server, steal data, or use it for further attacks.
1. Detecting the Attack
Confirm an attack before taking action.
Review the authentication log. Look for repeated “Failed password” entries from the same IP or many distinct IPs.
Use WHM’s Security Center. The “Security Advisor” and “SSH Access” tabs highlight suspicious activity.
Leverage fail2ban (if installed). It automatically bans IPs after a configurable number of failures.
Example command to view recent SSH failures (run as root):
Create a local jail override to avoid editing the default file:
cat > /etc/fail2ban/jail.d/ssh.conf <
On Debian/Ubuntu replace /var/log/secure with /var/log/auth.log:
logpath = /var/log/auth.log
Restart fail2ban to apply the new jail:
systemctl restart fail2ban
5. Post‑Incident Review and Documentation
After the attack is mitigated, review the event and update security policies.
Log analysis. Export the relevant portion of the auth log for future reference.
Update WHM security settings. In WHM → Security Center → SSH Password Authorization Tweak, ensure “Disable Password Authentication” is enabled.
Document the response. Record blocked IPs, configuration changes, and lessons learned. This speeds up future responses.
Notify stakeholders. If the server hosts client websites, inform them that a security incident occurred and that corrective actions have been taken.
6. Ongoing Monitoring and Best Practices
Security is continuous. Perform these routine checks:
Schedule a daily fail2ban-client status sshd check to verify active bans.
Enable WHM’s “Security Advisor” alerts for SSH configuration drift.
Rotate SSH keys annually and remove unused keys from ~/.ssh/authorized_keys.
Consider a VPN or bastion host for administrative SSH access to limit exposure to the public internet.
Regularly patch the operating system and cPanel/WHM updates, as they often contain security fixes that reduce the attack surface.
Conclusion
An active SSH brute‑force attack on a WHM server can be stopped quickly if you follow a clear, step‑by‑step response plan: detect malicious traffic, block offending IPs, harden SSH, automate protection with fail2ban, and review the incident. By applying these measures on both AlmaLinux/RHEL‑based and Debian/Ubuntu‑based systems, you keep your Indian‑hosted web and application services resilient against automated attacks.