Two-Factor Authentication (2FA) is a mechanism for protecting access to the Control Panel. As its name suggests, it consists of requesting a double authentication each time you access the Control Panel. To use this functionality, you will need a two-factor authentication mobile application, for example:
To enable Two-Factor Authentication you need to go to the Control Panel and under “System “ > “2FA “ click on “Enable Two-Factor Authentication”. You will then be prompted to scan a QR code (for this you will need one of the apps mentioned above) and indicate the token provided by the app.
Remember that once the double authentication is activated, the smartphone used will be linked to your account and will be the only one that will be able to receive the token to access the Control Panel. In case you lose access to your device, you will also be able to use the “backup tokens” to gain access.
Once the 2FA functionality is activated, every time you want to access the Control Panel you will have to:
First: enter your Control Panel login credentials (as you would normally do).
Secondly: you will be asked for a token (6-digit code) that will be offered by the mobile application you have used to connect to the device.
If you do not have access to this device you will be able to enter a “Backup token”. To obtain the copy of the “Backup tokens” you have to access the Control Panel and in “System” > “2FA”, in the “Backup tokens” section, click on “Show tokens”. If you do not have any backup tokens yet, click on “Generate backup tokens”. Each token is for single use only. Before using them all do not forget to generate a new set.
If you do not have backup tokens or access to the linked device, you can proceed to disable 2FA via command line as explained below.
From the Control Panel¶
If at any time you want to disable the two-factor authentication functionality you can do so from the Control Panel, under “System” > “2FA”, click on “Disable Two-Factor Authentication”. You will be prompted to confirm your decision.
Using the command line¶
If you do not have access to the Control Panel you will have to access the server via ssh with the Superuser account and execute the following commands:
To access via ssh:
Get permissions of Superuser:
Log in with Control Panel user:
sudo -u mxcp -s
Go to the Control Panel directory:
Activate virtual environment:
Go to the directory where the file you need to execute is located:
Execute the command for disabling 2FA (replace USER_CPANEL by control panel user):
./manage.py two_factor_disable USER_CPANEL
Deactivate the virtual environment: