NextCloud 2 Factor

I enabled the 2-factor authentication inside of Next Cloud on my admin account. However now when I try to log in I get this message:

Error while validating your second factor

I am trying to figure out how I can log back into NextCloud. Any advice? Can I disable 2FA from CLI?

There are a few places to enable 2fa, and I’m not sure that they’re linked in the backend. Perhaps some have been confused? E.g. Admin website 2fa and nextcloud 2fa?
Anyway, to disable 2fa for a nextcloud user via cli use:

cd /usr/local/lib/owncloud
sudo -u www-data php occ twofactorauth:disable <username>

Not sure if this will cause issues with the other 2fa uses of mailinabox, so use with caution.
Just using occ (without anything after that) will get you some short explanation on available commands.

Thank you so much! This pointed me in the right direction and I got back in. When I entered that command I got the error:
Not enough arguments (missing: “provider_id”).

However some quick searching I found that this worked:

sudo -u www-data php occ twofactorauth:disable username totp

So glad to have access to my files again! Thank you again.

1 Like

This topic was automatically closed 40 days after the last reply. New replies are no longer allowed.