How to deactivate two factor authentication in Nextcloud

Docker

Reading Time: 2 minutes

I need to deactivate two factor authentication in Nextcloud because…

I configured my smart phone for webauthn for Nextcloud
I mistakenly sold this smart phone
-> I cound't log in Nextcloud



To solve this I temporarily deactivated two factor authentication.
Reference

If you are interested in how to install webauthn, please go to this post.



Please log in your server host by SSH or others and do this command.
I use docker-compose, so please assume.

$ sudo docker-compose exec -u www-data nextcloud php occ twofactorauth:state admin
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.
Two-factor authentication is enabled for user admin

Enabled providers:
- webauthn
Disabled providers:
- backup_codes
- email
- rcdevsopenotp
- totp
- u2f

We notice “webauthn” is used for two factor authentication.

Next step is to disable it.

$ sudo docker-compose exec -u www-data nextcloud php occ twofactorauth:disable admin webauthn
The process control (PCNTL) extensions are required in case you want to interrupt long running commands - see https://www.php.net/manual/en/book.pcntl.php
Additionally the function 'pcntl_signal' and 'pcntl_signal_dispatch' need to be enabled in your php.ini.
Two-factor provider webauthn disabled for user admin.

We successfully disabled two factor authentication, then you can log in and setup webauthn with new smart phone!

Conclusion

How was it?

I may sometimes do this mistake, so I summrized how to recover!

Comments

Copied title and URL