Turning Off Two Factor Authentication for an Administrator#

An administrator who has lost the phone or authenticator app they sign in with cannot get past the code prompt on the login page. In the panel, two factor authentication is turned off from the administrator’s own account settings, so when they cannot sign in, it is turned off from the server instead.

You need root access to the SynergyCP master host and the email address of the administrator’s account.

Turn it off#

Log in as the root user on the SynergyCP master host and run:

/scp/bin/scp-exec php_s php artisan two-factor:disable <EMAIL> admin

Change <EMAIL> to the email address of the administrator’s account, for example:

/scp/bin/scp-exec php_s php artisan two-factor:disable [email protected] admin

The command answers:

Two Factor Authentication disabled for [email protected]

The administrator can now sign in with their username and password alone.

To turn it off for several administrators at once, separate the email addresses with commas and no spaces:

/scp/bin/scp-exec php_s php artisan two-factor:disable [email protected],[email protected] admin

The command looks the account up by its email address, not by its username. If you only know the username, see Finding the email address.

After they sign in#

The account is now protected by its password only, so have the administrator set two factor authentication up again straight away:

  1. Sign in to the admin panel and open Account Settings from the user drop-down.
  2. Under Two Factor Authentication, remove the entry of the device that was lost.
  3. Add the new device, verify it with a code, and check Require Two Factor Authentication.

If the password may be known to someone else as well, change it in the same place.

Finding the email address#

Another administrator can read it from Users > Administrators in the admin panel.

If nobody can sign in, list every administrator from the master host:

/scp/bin/scp-exec php_s php artisan tinker --execute='foreach (App\Admin\Admin::all() as $a) { echo $a->username."  ".$a->email."  2FA: ".($a->auth_verify_require ? "on" : "off").PHP_EOL; }'

Each line shows a username, its email address, and whether two factor authentication is on for that account:

jane  [email protected]  2FA: on
john  [email protected]  2FA: off

If the command reports an error#

Message Meaning
Not enough arguments (missing: "users, type") The email address and the word admin are both needed after two-factor:disable.
Attempt to assign property "auth_verify_require" on null No administrator has that email address. Nothing was changed. Check the address with the list above.
INVALID_EMAIL_FORMAT What was given is not an email address, for example a username.
INVALID_USER_TYPE The last word must be admin (or client, see below).

If two factor authentication is required for all administrators#

This section applies to SynergyCP 5.6.1 and newer. The requirement was added in 5.6.1; on older versions there is no such setting and the two-factor:require-admins command does not exist, so you can skip this section.

SynergyCP 5.6.1 adds the setting Require two factor authentication for administrators under System > Settings > Security. It is off unless you turn it on. While it is checked, the command above still lets the administrator sign in without a code, but the panel takes them to the two factor authentication setup and nothing else is available to them until they have turned it on again.

That is usually what you want. If administrators need to work without two factor authentication for a while, turn the requirement off as well:

/scp/bin/scp-exec php_s php artisan two-factor:require-admins off

Turn it back on under System > Settings > Security once everyone has two factor authentication set up again.

Clients#

The same command turns two factor authentication off for a client when admin is replaced by client:

/scp/bin/scp-exec php_s php artisan two-factor:disable <EMAIL> client