Skip to content
STAGE33R

Guides · Server software · 7 steps · reviewed

cPanel and WHM security checklist: updates, access, two-factor and what to expose

A cPanel server concentrates many websites and many passwords behind one control panel. Keeping it patched, limiting who can reach WHM and requiring a second factor covers most of the risk.

  1. Check the version and update settings

    In WHM open Update Preferences and choose automatic updates for the release tier you want, and confirm the server really is on a supported version. Run the update by hand to see the result.

    /usr/local/cpanel/cpanel -V
    /scripts/upcp
  2. Turn on two-factor authentication

    In WHM open Two-Factor Authentication and enable it for the server, then require it for the root and reseller accounts.

  3. Limit who can reach WHM

    Allow ports 2087 and 2083 only from your own addresses or a VPN if possible, and keep a firewall such as CSF or the host firewall in front of the panel. Keep your own access open before you close the rest.

  4. Harden SSH

    Use keys, disable password login for root and keep AllowUsers short.

    sudo sshd -T | grep -Ei 'permitrootlogin|passwordauthentication'
  5. Review accounts and the compromise checks

    Remove accounts of cancelled customers, look for unknown resellers and unfamiliar cron jobs, and run the built-in security advisor in WHM.

    ls /var/cpanel/users | head -n 100
    sudo crontab -l
  6. Keep PHP current for every site

    In MultiPHP Manager move sites off end-of-life PHP versions, one at a time, testing each.

  7. Test a restore

    Configure backups to a second location and restore one account to confirm it works.

Common mistakes

  • Leaving WHM open to the whole internet with only a password.
  • Auto-updates off and nobody reading the advisories.
  • Backups that only live on the same server.
  • Old accounts and old PHP versions nobody owns.

How to undo it

Re-enable any access you restricted by reverting the firewall rule from the host console, and restore the previous SSH settings from your backup of /etc/ssh.

Sources

Commands are for Debian and Ubuntu unless noted. Test on a copy first and keep a backup: you are responsible for changes on your own systems.