Disable 2FA for admin

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 22.2.2
Operating system and version (eg, Ubuntu 20.04): Debian GNU/Linux 11 (bullseye)
Apache or nginx version (eg, Apache 2.4.25): 2.4.51
PHP version (eg, 7.4): 7.4

The issue you are facing: Forgot my first 2FA code as an admin. Tried to disable 2FA with occ twofactorauth:disable eric totp, with no succes

Is this the first time you’ve seen this error? (Y/N): Y

Steps to replicate it:

  1. Enable 2FA
  2. Log out
  3. Log in without the code

The output of your Nextcloud log in Admin > Logging:

Lost access to the gui

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'instanceid' => 'aaa',
  'passwordsalt' => 'aaa',
  'secret' => 'aaa',
  'trusted_domains' => 
  array (
    0 => 'nextcloud.aaa.fr',
    1 => 'vault.aaa.fr',
  ),
  0 => 
  array (
    0 => '192.168.1.104',
  ),
  'datadirectory' => '/media/nas/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.2.0',
  'overwrite.cli.url' => 'http://192.168.1.104/nextcloud',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'nextcloud',
  'dbpassword' => 'aaa',
  'installed' => true,
  'default_phone_region' => 'FR',
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'updater.secret' => 'aaa',
  'maintenance' => false,
  'theme' => '',
  'loglevel' => 2,
  'twofactor_enforced' => 'false',
  'twofactor_enforced_groups' => 
  array (
    0 => 'admin',
  ),
  'twofactor_enforced_excluded_groups' => 
  array (
  ),
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => 'eric',
  'mail_domain' => 'aaa.fr',
  'mail_smtphost' => 'aaa.fr',
  'mail_smtpport' => '465',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'eric',
  'mail_smtppassword' => 'aaa',
);

The output of your Apache/nginx/system log in /var/log/____:

[14-Nov-2021 00:00:09] NOTICE: error log file re-opened
[14-Nov-2021 15:44:19] NOTICE: [pool nextcloud] child 11856 exited with code 0 after 2020.203206 seconds from start
[14-Nov-2021 15:44:19] NOTICE: [pool nextcloud] child 13046 started
[14-Nov-2021 16:51:04] NOTICE: [pool nextcloud] child 12959 exited with code 0 after 4410.097092 seconds from start
[14-Nov-2021 16:51:04] NOTICE: [pool nextcloud] child 13566 started
[14-Nov-2021 17:29:08] NOTICE: Terminating ...
[14-Nov-2021 17:29:08] NOTICE: exiting, bye-bye!
[14-Nov-2021 17:29:09] NOTICE: fpm is running, pid 13891
[14-Nov-2021 17:29:09] NOTICE: ready to handle connections
[14-Nov-2021 17:29:09] NOTICE: systemd monitor interval set to 10000ms

Installed apps

Enabled:
  - accessibility: 1.8.0
  - activity: 2.15.0
  - bruteforcesettings: 2.2.0
  - calendar: 2.3.4
  - circles: 22.1.1
  - cloud_federation_api: 1.5.0
  - comments: 1.12.0
  - contacts: 4.0.6
  - contactsinteraction: 1.3.0
  - dashboard: 7.2.0
  - dav: 1.19.0
  - federatedfilesharing: 1.12.0
  - federation: 1.12.0
  - files: 1.17.0
  - files_pdfviewer: 2.3.1
  - files_rightclick: 1.1.0
  - files_sharing: 1.14.0
  - files_trashbin: 1.12.0
  - files_versions: 1.15.0
  - files_videoplayer: 1.11.0
  - firstrunwizard: 2.11.0
  - logreader: 2.7.0
  - lookup_server_connector: 1.10.0
  - mail: 1.10.5
  - nextcloud_announcements: 1.11.0
  - notifications: 2.10.1
  - oauth2: 1.10.0
  - password_policy: 1.12.0
  - passwords: 2021.11.20
  - photos: 1.4.0
  - privacy: 1.6.0
  - provisioning_api: 1.12.0
  - recommendations: 1.1.0
  - serverinfo: 1.12.0
  - settings: 1.4.0
  - sharebymail: 1.12.0
  - spreed: 12.1.2
  - support: 1.5.0
  - survey_client: 1.10.0
  - systemtags: 1.12.0
  - text: 3.3.0
  - theming: 1.13.0
  - twofactor_admin: 3.1.0
  - twofactor_backupcodes: 1.11.0
  - twofactor_totp: 6.1.0
  - updatenotification: 1.12.0
  - user_status: 1.2.0
  - viewer: 1.6.0
  - weather_status: 1.2.0
  - workflowengine: 2.4.0
Disabled:
  - admin_audit
  - encryption
  - files_external
  - user_ldap

Is there any output of used occ command?

Have you tried to disable twofactor_totp app using occ?

Here it is

eric@vault:/ $ sudo -u nextcloud php /var/www/html/nextcloud/occ twofactorauth:disable eric totp
Two-factor provider totp disabled for user eric.
eric@vault:/ $ sudo -u nextcloud php /var/www/html/nextcloud/occ twofactorauth:disable eric totp
Two-factor provider totp disabled for user eric.
eric@vault:/ $ sudo -u nextcloud php /var/www/html/nextcloud/occ user:disable eric
The specified user is disabled
eric@vault:/ $ sudo -u nextcloud php /var/www/html/nextcloud/occ user:enable eric
The specified user is enabled

Very strange : I have access through my mobile phone, but not through my computer, although I have reset firefox memory. I think the problem comes from my side. I try and reboot the computer and tell you.

1 Like

Very strange : still impossible to login after a reboot. I try with a Windows computer

Impossible to connect either from the Windows computer, but maybe I can do something from my mobile to reestablish the usual one factor login ?

I finally did it with 2 recuperation codes ! :thinking:Thanks for helping ! :grinning:

But it still asks for a code to log in again : I am using all my recuperation code :roll_eyes:

I have tried to set up another 2FA with TOTP, it proposes me either TOTP and admin code. How might I get rid of this admin code proposal ?

I finally re-issued an admin code and entered it. Everything ok.

1 Like