How to disable two-factor-authentication without web-access?

Dear all,

I’ve enabled it via webinterface but something went wrong while scanning qr-code.
Is it possible to disable without login??

I have root-acess to the server … (Ubuntu 16.04 LTS)

Thank you

You can use the occ command. For example,

./occ twofactorauth:disable username

2 Likes

Sure?

as root it says no rights …

Hello,

Are you able to run the occ command by it’s self? Try running it as the same user the Nextcloud installation is running as. Also check that the occ command has execute permissions.

If you are receiving an error, can you paste the exact response here.

Thanks for your help …

See here … https://escher.cc/error.txt

I set occ to 777 - Do I still have to run as www-data?

Hello,

The errors indicate something is wrong with the PHP set up. This may just be because you are not running the command as the right user. Trying running the command while being the www-data user.

See https://docs.nextcloud.com/server/10/admin_manual/configuration_server/occ_command.html?highlight=occ#http-user-label for more assistance in running the OCC command.

Machine rebooted,

tescher@SV-SYDNEY:/var/www/escher.cc/htdocs/nextcloud$ sudo -u www-data php occ
An unhandled exception has been thrown:
Doctrine\DBAL\DBALException: Failed to connect to the database: An exception occured in driver: could not find driver in /var/www/escher.cc/htdocs/nextcloud/lib/private/DB/Connection.php:59

Same problem - that’s bad :frowning:

Update: I can login with a 2nd Admin-User - is there something possible, to disable 2fa for the other user?

I’m using PHP7 - maybe a parallel installation of php 5 may help??

Hello,

Sorry for the delay. I was testing occ with PHP 7.0. It seems to work fine.

Looking at the error log, it appears to be something in the server configuration, that is causing issues with occ/php execution. I advise talking to your hosting company or server administrator for assistance resolving that.

Once the occ issues are resolved, you should be able to disable the two factor authentication per my comments above.

Dear Tim,

thanks. I solved the problem with a temporary installation of php5.6.
It seems, that my php7.0 is a little bit buggy …

I tried Ubuntu 16.04 in a virtualbox-session with nginx and php7.0. occ worked out of the box … very nice. I will investigate for this problem later … I can acess my data now again - that was the important part ;-))

Thanks again,

Tom