Turn on two-factor authentication (2FA) for cPanel
Two-factor authentication (2FA) adds a second check when you log in to cPanel: besides your password, cPanel asks for a six-digit code generated by an app on your phone. Even if your password is stolen, it is no longer enough to get in.
Before you start
- The feature must be enabled by the hosting provider. According to the cPanel documentation, the provider enables two-factor authentication on the server, then each user sets it up for their own account. If the icon described below does not appear in cPanel, the feature is not enabled for your account: ask support for it (see Open a support request).
- Install an authenticator app on your smartphone. cPanel mentions Google Authenticator for Android and Duo Mobile for iOS.
- You can log in to cPanel (see Log in to cPanel).
- This article is about logging in to cPanel. Two-factor authentication for your client area is a different feature: see Turn on two-factor authentication. The webmail one is set in the webmail settings.
Steps
- In cPanel, open Security, then Two-Factor Authentication.
- Click Set Up Two-Factor Authentication.
- Link your cPanel account and your app in one of two ways:
- automatically: scan the QR code shown with the app;
- by hand: enter the Account and Key information shown into the app.
- In the app, read the six-digit code.
- Enter it in the Security Code box, before it expires (it changes regularly).
- Click Configure Two-Factor Authentication.
From then on, cPanel asks for this code at every login, after the password.
Expected result
When you log in to cPanel again, once the password is entered, a field asks for the security code. You enter the code shown in the app, and cPanel opens.
If something goes wrong
- The message "Failed to set user configuration: The security code is invalid." appears. The code may have expired: enter the next one. If the error persists, cPanel says there may be a problem with the server's date and time: open a support request. Also check your phone's clock.
- You lost access to the app (lost or replaced phone). You can no longer log in. According to cPanel, you must contact the hosting provider, who turns off two-factor authentication for your account; you can then set it up again. Open a support request from your client area (see Open a support request).
- The Two-Factor Authentication icon is missing. See "Before you start": the feature is not enabled for your account.
- You want to change phone. Click Reconfigure, then repeat the steps above. Careful: this replaces the old setup (codes from the old app stop working) and logs out your other open cPanel windows.
- You want to turn two-factor authentication off. Click Remove Two-Factor Authentication. cPanel will no longer ask for a code.
Frequently asked questions
Does two-factor authentication also protect my email and FTP?
No. It protects the login to the cPanel interface. The passwords of your mailboxes and FTP accounts remain separate protections: choose strong ones (see Forgotten cPanel, webmail or FTP password).
What if my phone's battery is dead?
You cannot generate a code, so you cannot log in to cPanel until the phone is charged. Keep your phone charged, or keep a way of reaching support at hand.
Should I keep the key shown in step 3?
If you entered it by hand, keep it somewhere safe (a password manager, for example): it lets you recreate the setup on another phone. Do not share it with anyone.
Is two-factor authentication mandatory?
No, it is your choice. It is strongly advised if your site handles customers or data.
Related articles
- Log in to cPanel: address, credentials and a tour of the interface
- I can't log in to cPanel: causes and solutions
- Turn on two-factor authentication (client area)
A site to protect? See our security solutions.