Turn On Two-Factor Login for cPanel and WHM Accounts
A stolen hosting password can be enough to take over a site. Add a six-digit code from your phone to cPanel and WHM logins, and plan for a lost phone.
The short answer
To protect a cPanel login with two-factor authentication, your host first enables the Two-Factor Authentication policy in WHM, then you set it up yourself in cPanel by scanning a QR code with an authenticator app and entering the six-digit code. If codes fail, check the server and phone clocks. If you lose your phone, your host must disable 2FA on your account so you can set it up again.

Reading options
On this page
- What two-factor login actually is
- Before you start
- Turn on 2FA for your cPanel account
- Changing or removing 2FA later
- The admin side: enabling 2FA in WHM
- Resellers and VPS owners
- Choosing an authenticator app
- How to check it worked
- Troubleshooting
- Pro tips and security notes
- The one message worth forwarding
- Reader questions
- Sources & further reading
Before you start
A working cPanel login; a trusted TOTP authenticator with automatic phone time enabled; a verified way to contact the hosting provider if the phone is lost; and a plan to test password-based integrations because API password requests need a separate WHM security policy.
You can add a second lock to your cPanel login with two-factor authentication, usually called 2FA. Once it is on, cPanel asks for your password and then a six-digit code from an app on your phone, so a stolen password alone no longer gets anyone in. Your host has to switch the feature on for the server first, and after that you set it up yourself in a few minutes.
Hosting passwords leak in boring ways, like a reused password from an old forum breach or a phishing email dressed up as a renewal notice. Whoever holds yours can open File Manager and replace your site.
By the end of this guide you will be able to turn on 2FA for your cPanel account, confirm it really works, and know exactly what to do if you lose your phone.
What two-factor login actually is
Two-factor login means proving who you are with two different kinds of thing: something you know (your password) and something you have (your phone).
Think of a bank card at a cash machine. The card on its own is useless without the PIN, and the PIN is useless without the card. A thief needs both, which is far harder than stealing one.
cPanel uses a standard called TOTP, short for time-based one-time password. Your phone app and the server share a secret key, and both use the current time to work out the same six-digit code. The WHM documentation explains that the code changes every 30 seconds, so a code someone copies over your shoulder goes stale almost at once.
Why this matters: because the code is built from the time, the clock on the server and the clock on your phone both need to be right. Keep that in mind, because it explains most of the errors people hit.
Before you start
Run through this list before you click anything. It takes two minutes and saves a support ticket later.
- An authenticator app installed on your phone. Any TOTP app will do; more on choices below.
- Your current cPanel username and password, and a working login right now.
- A backup plan: a second admin account on the same service where that applies, or a confirmed way to reach your host's support team if you get locked out.
- Your phone's date and time set to update automatically.
- Five quiet minutes, because the code on screen expires quickly.
Heads up: once 2FA is on, the cPanel docs say plainly, "Without your smartphone, you cannot log in." If you lose the phone, your hosting provider has to disable 2FA on your account before you can get back in. That is a feature, since it stops an attacker doing the same, but it means your recovery route runs through your host. Check you know how to contact them before you start.
Turn on 2FA for your cPanel account
These steps follow the official cPanel documentation. Button names are quoted exactly as the docs show them.
Step 1: Check that your host has enabled the feature
According to the cPanel docs, your hosting provider must enable 2FA in WHM » Home » Security Center » Two-Factor Authentication before you can use it. You cannot do this part from inside cPanel.
Log in to cPanel and look for an interface named Two-Factor Authentication. If you cannot find it, your host may not have turned it on, or may have hidden it: the docs note that providers can enable or disable this interface through WHM's Feature Manager. In that case, skip to the message near the end of this post and send it to your host.
Step 2: Install an authenticator app
Install your chosen app on your phone before you open the setup screen. The cPanel docs say to install the app first, before you work through the setup steps.
Step 3: Start the setup
Open the Two-Factor Authentication interface in cPanel and click "Set Up Two-Factor Authentication." The page shows a QR code, plus two text values labelled Account and Key.
Step 4: Link your app
Open the authenticator app and add a new account. Point the camera at the QR code. If the camera will not cooperate, enter the Account and Key values by hand instead.
You should now see a new entry in your app with a six-digit code that counts down and refreshes.
Quick tip: if you type the Key manually, copy it exactly. One wrong character produces a valid-looking code that the server will reject.
Step 5: Enter the security code
Type the current six-digit code from the app into the Security Code field in cPanel. Do it before the code expires; if the countdown is almost at zero, wait for the next code rather than racing it.
Step 6: Save it
Click "Configure Two-Factor Authentication." From this point on, cPanel will ask for a code from your app every time you log in.
Heads up: the cPanel docs say that setting up 2FA logs out all your other open cPanel browser windows. If you had cPanel open in another tab, expect it to ask you to log in again.
What about Webmail?
The cPanel page linked in the sources covers cPanel logins only. The docs say Webmail 2FA is documented separately, so if you also want a code on your Webmail login, check the Webmail section of the cPanel docs or ask your host.
Changing or removing 2FA later
You might change phones, or decide to switch apps. In cPanel's Two-Factor Authentication interface, click "Reconfigure" and repeat the setup steps.
Why this matters: the cPanel docs warn, "This action will overwrite your account's existing 2FA configuration." The WHM docs put it even more directly: "If you reconfigure 2FA for your account, any existing configurations will no longer produce valid security codes." So the entry in your old app stops working the moment you reconfigure. Delete it from the old app afterwards so you are not confused by it later.
To turn 2FA off completely, click "Remove Two-Factor Authentication." Logins will go back to password only. I would only do that if you are replacing it with something better, not because the codes feel like a chore.
The admin side: enabling 2FA in WHM
This section is for whoever has root access to the server, which on shared hosting means your host, not you. It is still worth reading so you know what to ask for.
Turn on the security policy
Open WHM » Home » Security Center » Two-Factor Authentication. The WHM docs say, "As the root user, set the toggle to On." The interface should then show the message "The Two-Factor Authentication Security Policy is Enabled."
Heads up: the WHM docs carry a clear warning: "This feature may cause some third-party applications to fail." If the server runs tools that log in to cPanel or WHM with a username and password, test them after you flip the switch.
Know what WHM can and cannot do for users
The WHM docs state, "You cannot enable 2FA for a cPanel account through the WHM interface." The admin turns on the policy, and each cPanel user then sets up their own phone. There is no way to do it on a customer's behalf, which makes sense: the admin should never hold a customer's second factor.
The Settings tab includes an Issuer setting. The WHM docs say it "determines the name that appears in many authentication apps," and if you leave it blank it defaults to the server's hostname. A recognisable issuer name helps customers tell which entry in their app belongs to which login.
Help a user who lost their phone
In the Manage Users tab, WHM lists accounts that have 2FA set up. The docs say, "To disable 2FA for a single user account on the Manage Users list, click Disable to the right of the user account." The user can then log in with just their password and set up 2FA again on the new phone.
Quick tip for admins: before you click Disable, confirm the request really comes from the account owner, through a contact method already on file. A "lost phone" ticket is exactly what an attacker holding a stolen password would send.
Protect API logins too
This one surprises people. The cPanel docs say, "API requests that use password authentication can bypass the 2FA challenge." Turning on 2FA protects the login page, but a script that sends a username and password straight to the API can still get through.
The fix lives in WHM » Home » Security Center » Configure Security Policies. The WHM docs say to turn on the API requests option in the Security Policy Extensions section. API tokens are not affected by this, and the cPanel docs say they "remain the recommended authentication method for integrations."
Resellers and VPS owners
If you are a reseller, you log in to WHM with your own account, and you can protect that login too. The WHM docs have a Manage My Account tab for root and reseller users, with the same buttons: "Set Up Two-Factor Authentication," "Configure Two-Factor Authentication," "Reconfigure" and "Remove Two-Factor Authentication."
There is one condition. The WHM docs say a reseller account must have the Create Accounts (create-acct) privilege to use 2FA in WHM. That privilege is set by the server owner in Edit Reseller Nameservers and Privileges. If you are a reseller and cannot see the option, ask your host whether your account has it.
Resellers usually have customers of their own. When a customer loses their phone, they will come to you. If your WHM access includes the Manage Users tab, you can use the same Disable steps above; if not, pass the request to your host with the account name.
If you run your own VPS or dedicated server with WHM, you are the provider in every sentence of this guide. You enable the policy and you handle the lost-phone requests. Set up 2FA on your own root login first, then on any reseller accounts, then tell your customers it is available.
Check the server clock
Because TOTP codes depend on time, a server clock that has drifted will reject correct codes. The WHM docs suggest checking the date and time settings if you see errors, and mention the ntpdate command for resyncing. Many current Linux servers use timedatectl and chrony instead, so check what your server runs.
On a server with systemd, run this to see the current clock settings; the man page says it is the default when you give no command:
timedatectl statusYou want to see a line reading System clock synchronized: yes and a correct local time. If it says no, network time sync is not active and is worth fixing.
If your server uses chrony, this command "displays parameters about the system's clock performance," according to the chronyc manual:
chronyc trackingLook at the System time line, which shows how far the system clock is from chrony's idea of the correct time. A large offset there is a good reason to fix time sync before blaming 2FA.
Choosing an authenticator app
At the time of writing (16 November 2026), the cPanel docs name Google Authenticator for Android and Duo Mobile for iOS. The WHM docs suggest both apps for Android and iOS, and say 2FA needs "a supported time-based one-time password (TOTP) app."
In practice, any standard TOTP app should work, since they all follow the same open standard. Pick one you trust and will actually keep, ideally with a backup or transfer option you understand.
Quick tip: some apps can back up your entries to the cloud, others keep them on the device only. Whichever you choose, find out how you would move to a new phone before you need to. The cPanel docs and app stores change over time, so check the current recommendations before you install.
How to check it worked
Do this straight after setup, while you still have support's contact details handy.
- Log out of cPanel completely.
- Log in again with your username and password.
- Confirm that cPanel now asks for a security code before letting you in.
- Enter the current code from your app and check you land on your normal cPanel home.
If cPanel lets you in without asking for a code, 2FA is not active on your account. Go back to the Two-Factor Authentication interface and check its status.
If the code prompt appears but your codes keep failing, check the time first. Make sure your phone's date and time are set automatically, and ask your host to check the server clock.
Troubleshooting
Here are common problems, with the error text where cPanel gives one.
"Failed to set user configuration: The security code is invalid."
Likely cause: this exact message is in both the cPanel and WHM docs, and both point to the server's date and time being wrong. A typo in a manually entered Key can also cause it.
Fix: wait for a fresh code and try again. If it still fails, ask your host to check the server clock, and if you typed the Key by hand, start again and scan the QR code instead.
The code was accepted at setup, but now login fails
Likely cause: your phone's clock has drifted, or you reconfigured 2FA and are reading a code from the old entry.
Fix: set your phone to automatic date and time. If you have reconfigured, delete the old entry from your app and use the newest one.
"I can't find Two-Factor Authentication in cPanel"
Likely cause: your host has not enabled the policy in WHM, or has hidden the interface with Feature Manager.
Fix: ask your host to enable it. The message near the end of this post does the job.
I lost my phone, or wiped it
Likely cause: the secret key lived only on that device.
Fix: contact your host and ask them to disable 2FA on your account. The cPanel docs say you should "contact your hosting provider to disable your account's 2FA access." Once they have, log in with your password and set it up again on the new phone.
I keep getting logged out of other tabs
Likely cause: the WHM docs say, "2FA supports only one concurrent session for any user." Logging out in one window logs you out of the others.
Fix: work in one browser window at a time. If two people share one login, give each their own account where the service allows it.
A plugin or external tool stopped connecting
Likely cause: the WHM docs warn that this feature "may cause some third-party applications to fail."
Fix: if the tool supports API tokens, switch it to a token. If it only supports a password, check with the tool's vendor before you weaken your security to suit it.
Pro tips and security notes
Use API tokens for scripts and integrations, not your password. The cPanel docs call them the recommended method, and a token can be revoked without changing your login.
Give your authenticator entry a clear name. A made-up example: if you manage example.com and two client sites, rename the entries so you never type the wrong site's code under pressure.
Do not screenshot the QR code or email the Key to yourself. That turns your second factor back into something a thief can steal from your inbox.
Pair 2FA with a strong, unique password. The code protects the login, but a reused password still exposes every other service that shares it. While you are tidying security, it is worth reviewing other access too: our guide to auditing WordPress application passwords covers a similar blind spot on the WordPress side, and password protecting a staging folder in cPanel keeps half-built sites away from search engines and strangers.
A short made-up scenario: a shop owner reuses their cPanel password on a recipe site that later leaks its user list. Someone tries that password on the shop's cPanel login a week later. With 2FA on, they reach the code prompt and stop there, and the owner never knows how close it was. That is the whole point.
If you are new to how all these pieces fit together, our plain-English explainer on what web hosting is is a good place to start.
The one message worth forwarding
If you cannot set up 2FA yourself, or you are locked out, send something like this to your host's support team from the email address on your account:
Subject: Two-factor authentication for my cPanel account (example.com)
Hello,
I would like to use two-factor authentication on my cPanel account for example.com.
Choose one:
1. Please enable the Two-Factor Authentication security policy in WHM so I can set it up myself in cPanel.
2. I have lost access to my authenticator app. Please disable 2FA on my account so I can set it up again on my new phone.
I can verify my identity using the details on file. Could you also confirm whether Security Policies for API requests are enabled on this server?
Thank you.The takeaway: a six-digit code on top of your password is a practical, low-cost layer for a hosting account. Set it up, protect the recovery route, and know how account ownership will be verified before you need help.
Reader questions
Can my host turn on 2FA for my cPanel account for me?
No. The host can enable the 2FA policy for the server, but the WHM docs say a cPanel account's 2FA cannot be enabled through WHM, so you link your own phone in cPanel.
Does 2FA in cPanel also protect my Webmail login?
Not automatically through the cPanel setup described here. The cPanel docs say Webmail 2FA is documented separately, so check that page or ask your host.
Will 2FA slow down my website?
No. It only adds a step when someone logs in to cPanel or WHM, and visitors to your site never see it.
Can I use the same authenticator app for other accounts?
Yes. One TOTP app can hold codes for many services, and each appears as its own entry with its own code.
What happens if my phone's battery dies when I need to log in?
You will need to charge it. The cPanel docs say that without your smartphone you cannot log in, and if you lose access your host can disable 2FA so you can set it up again.
Do I need mobile data or Wi-Fi to get a code?
Generally no. TOTP codes are worked out on the phone from a shared key and the current time, so the phone only needs an accurate clock.
Should resellers turn on 2FA for their own WHM login?
Yes, if your account has the Create Accounts privilege, which the WHM docs list as a requirement. Your WHM login can reach many customer accounts, so it is worth protecting.
Was this guide helpful?
Help us make the next update better.
Sources & further reading
What changed
Editorial and security review on 16 November 2026: checked the cPanel and WHM workflow against current documentation, clarified recovery and API-policy responsibilities, softened an unsupported superlative, refreshed the dated reference, and added an original accessible cover.
Originally published . About our editorial updates.



