cPanel/WHM Server Hardening Checklist (2026)
Most compromised cPanel servers are not breached through the panel. They are breached through a vulnerable plugin on one site, then spread because nothing isolates that account from the rest. This checklist is the baseline we apply to every server we take over. Test each step in a maintenance window and keep console access available in case you lock yourself out.
1. SSH
Use keys only, no password logins for root, and limit who can connect.
# /etc/ssh/sshd_config (or a drop-in under /etc/ssh/sshd_config.d/)
PermitRootLogin prohibit-password
PasswordAuthentication no
KbdInteractiveAuthentication no
MaxAuthTries 3
LoginGraceTime 30
AllowUsers root deploy
sshd -t && systemctl reload sshd
Moving SSH off port 22 cuts log noise but is not a security control on its own. If you move it, open the new port in the firewall before reloading.
2. WHM access
- Restrict WHM (2087) and cPanel (2083) access by IP where practical using Host Access Control, or at the firewall.
- Enable two-factor authentication for root and resellers in Two-Factor Authentication.
- Turn on cPHulk Brute Force Protection if you are not using Imunify360’s equivalent.
3. Firewall: CSF or Imunify360
Run one firewall manager, not both. With CSF:
csf -s # start
csf -r # reload after editing /etc/csf/csf.conf
# Key settings:
TESTING = "0"
RESTRICT_SYSLOG = "3"
LF_SSHD = "5"
LF_CPANEL = "10"
PORTFLOOD = "80;tcp;100;5,443;tcp;100;5"
Close every port you do not use. Common ones to leave closed on a web-only box: 3306 (MySQL) and 11211 (Memcached) to the public internet.
4. Web application firewall
Enable ModSecurity in WHM → Security Center → ModSecurity Vendors with the OWASP Core Rule Set, or use the Imunify360 WAF ruleset. Watch for false positives for a week (/usr/local/apache/logs/modsec_audit.log or Imunify’s incidents list) and whitelist by rule ID, never by disabling the WAF for a whole site.
5. Account isolation
On CloudLinux:
- CageFS enabled for all users, so one account cannot see another’s files or system binaries.
- PHP-FPM per user (or LSAPI with suEXEC) so PHP runs as the account owner.
- LVE limits sized for each package so one site cannot exhaust the server.
cagefsctl --list-enabled | head
lvectl list | head
Disable dangerous PHP functions in MultiPHP INI Editor unless a specific site needs them:
disable_functions = exec,passthru,shell_exec,system,proc_open,popen,pcntl_exec
6. Updates
- WHM → Update Preferences: automatic daily updates on the RELEASE tier.
- OS packages:
dnf -y updateon a schedule, or live kernel patching (KernelCare/TuxCare) to avoid reboots. - Remove EOL PHP versions that no account uses.
7. Malware and integrity
- Imunify360 or ImunifyAV with real-time scanning, or Maldet + ClamAV as a minimum.
- Weekly scan reports emailed to someone who reads them.
- Keep
/tmpmountednoexec,nosuid(WHM → Security Center → Securing /tmp).
8. TLS and headers
- AutoSSL on, TLS 1.2+ only, modern ciphers (WHM → Apache Configuration → Global Configuration).
- Add HSTS and basic security headers per site once HTTPS is stable.
9. Mail
SPF, DKIM and DMARC for every domain (WHM → Email Deliverability), outbound spam limits per account, and blacklist monitoring for the server IP.
10. Backups and monitoring
- Offsite backups (S3, Backblaze B2 or a remote server), with retention and a tested restore.
- Monitoring for load, memory, disk, inodes, MySQL and failed services, alerting to a phone, not just an inbox.
Quick audit commands
ss -tulpn # what is listening
grep -E '^(PermitRootLogin|PasswordAuthentication)' /etc/ssh/sshd_config
csf -l | head -40 # firewall rules
lastb | head # recent failed logins
If this list surfaces more than you have time for, we do this as a fixed-price service with a written report.