brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: occ twofactorauth:disable rescues a Nextcloud user who lost their phone

Nextcloud
~/tips/tip-nextcloud-twofactor-disable

docker exec --user www-data nextcloud php occ twofactorauth:state layla

Switches off one two factor method so a locked out user can log in.

The password is right, the code generator is at the bottom of a canal, and there are no backup codes. From the server you can still help.

First see what the account has switched on:

docker exec --user www-data nextcloud php occ twofactorauth:state layla

Then disable the one provider that’s in the way. The usual app based codes are called totp:

docker exec --user www-data nextcloud php occ twofactorauth:disable layla totp

Take the provider ID from the state output, not from the app’s name in the store. The user can now log in with just the password and set up the second factor again in their personal security settings. Ask them to do that right away, and to save the backup codes somewhere this time.

Not every provider supports being disabled this way, and Nextcloud stops with an error if yours doesn’t.

Check who is asking. This command removes a protection, and “I lost my phone” is exactly what an impostor would say, so I’d confirm in person or over a channel I already trust. If two factor login is enforced for the group, they’ll be asked to set it up again at the next sign in, which is what you want.

Don’t confuse it with twofactorauth:cleanup, which wipes a removed provider’s data for everyone and can’t be undone.

Further reading: Nextcloud two factor administration

Going deeper: Guide: put Nextcloud behind Nginx Proxy Manager with HTTPS and the right headers

More Nextcloud tips sudo -E -u www-data php occ user:report sudo -E -u www-data php occ app:update --showonly sudo -E -u www-data php occ background-job:history -s 3 -l 10 docker exec --user www-data nextcloud php occ maintenance:mode --on docker exec -it --user www-data nextcloud php occ user:resetpassword layla All Nextcloud tips (13) All topics

Link