Skip to content

Two-factor authentication for WHM administrators — mandatory baseline

How to make 2FA non-negotiable for WHM root and reseller logins, including the recovery path for the operator account that loses its TOTP token.

If WHM root and reseller logins are not 2FA-protected on a multi-tenant cPanel host, the rest of the security work is theater. Customer-side 2FA is a good thing; operator-side 2FA is a non-negotiable. The setup is identical to the customer flow but the rollout is shorter — there are 3 operators, not 300 customers.

What’s happening

WHM uses the same TOTP plumbing as cPanel user 2FA, exposed at WHM > Two-Factor Authentication for each WHM account. Resellers configure their own; root configures root’s. The policy toggle in WHM > Security Center > Two-Factor Authentication can require it for WHM logins specifically. There is no built-in hardware-token integration in WHM, but TOTP apps that run on YubiKey-class devices work fine.

How to verify

whmapi1 twofactorauth_policy
whmapi1 twofactorauth_get_user_configs | grep -A1 "root\|reseller"
last -i | grep root | head
grep "2FA" /usr/local/cpanel/logs/error_log | tail

The third line tells you which IPs are actually logging in as root. The fourth surfaces 2FA enrollment failures.

The fix

  1. Day 1: each WHM administrator account enrolls in 2FA via their WHM session. Backup codes printed and stored in the password manager.
  2. Day 1 evening: flip the policy to Required for WHM. Confirm by logging out and back in for each administrator.
  3. Root recovery path: the only way to disable 2FA on a root account without 2FA is via shell — whmapi1 twofactorauth_remove_user_config user=root. Document who has shell, what the on-call rotation is, and how the operator team identifies itself to the on-call.
  4. Reseller accounts: enable a policy that 2FA is required for any reseller with all-features privileges. Most accidental privilege escalations happen via resellers.
  5. No SMS fallback: WHM’s TOTP integration is app-based. Do not introduce SMS-based 2FA out of band; SIM-swap attacks are too easy.
  6. Quarterly audit: confirm that all operator accounts still have an active token, that backup codes are stored, and that nobody has set up “for testing” accounts without 2FA.

Stack Harbor enforces operator 2FA in the takeover runbook under cPanel/WHM management.