How to Use occ on Command Line to Disable Two-Factor Authentication and Get Logged In

Please help us by providing the following info. Before posting please also check the pinned "Known issues" threads and make sure that you're running the latest available version for your oC release:

Steps to reproduce
1. Enable two-factor authentication and can't set it up in admin area because of email issue
2. Log out and attempt to log back in
3. Receiving request for two-factor authentication that I forgot to disable but is not set up

Expected behaviour
Tell us what should happen

I thought I should be able to log back in and bypass two-factor authentication since Admin account isn't set up for it.

Actual behaviour
Tell us what happens instead

I enter Admin and password and get the two-factor authentication screen and have to cancel login.

Server configuration
Operating system: Centos 7.2
Web server: Apache
Database: MySQL
PHP version: 5.6
ownCloud version (see ownCloud admin page): 9.1
Updated from an older ownCloud or fresh install: Fresh Install
Special configuration (external storage, external authentication, reverse proxy, server-side-encryption): Two-Factor Authentication

ownCloud log (data/owncloud.log)

Please paste possible errors in the following code block, see for more info (Can't log in to see these errors)

Integrity status for oC9+

Login as admin user into your ownCloud and access
paste the results here. (Can't log in to see these errors

Hi Yksityinen.

Try running via occ twofactorauth:disable


sudo -u www-data ./occ twofactorauth:disable

If that command does not solve your problem, do not hesitate to write back here again.



1 Like

The easy way is to uninstall it from your owncloud.
If you can’t login to admin account. you can find the verify code from the oc_twofactor_backup_codes table in your owncloud database then you can login to admin account to uninstall it.