Enabled 2fa without establishing an app or admin

I am very new to this AND to command prompt use, i tried following some instructions but got snagged setting up my mail, then when logging in i found that gmail needed some kind of 2fa established so i went that direction and enabled my 2fa, not seeing any options for establishing which app to use and being used to very hand-holdy methods from windows/apple i assumed it would let me establish the app after logging out and attempting to log back in. To which i get the obvious message “Two-factor authentication is enforced but has not been configured on your account. Contact your admin for assistance.”, unfortunately I am the admin and apparently never set myself up in nextcloud that way.
Can anyone please help me remove or disable 2fa in command?

Also when setting up the email it says to check the log for the error, of which i’ve done a google search (because i’m pretty command illiterate) and the only hits i get are to use /var/log/maillog and a number of variations of that string but to no avail so I’m feeling pretty incompetent at the moment. Please help.

Hi,

please use:

sudo -u www-data php /var/www/nextcloud/occ twofactorauth:disable uid provider_id

okay, so, i put that line like:
occ twofactorauth:state johndoe

and get this back: “Command ‘occ’ not found, but there are 21 similar ones.”

I’m just sitting at the command line after logging into my headless-server so I’m not really sure if i’m supposed to be somewhere else first for this to work.

You need on normal linux systems something like this:

sudo -u www-data php /path/to/nextcloud/occ …

Learn more about linux if your system breaks and you must repair it.

you’re right dev, I do need to learn more about it. I am currently trying to work my through some command tutorials for linux. i haven’t used cmd or terminal in decades, i just dont use it regularly enough to know what -u or www-data or php even means, i created a problem for myself that is annoying for others to troubleshoot when I was hoping to just get the server up and going for my family for xmas.

At this point i haven’t done anything with nextcloud and am wondering if uninstalling it and reinstalling it would just fix the problem but as i said before i just dont know enough on even how to do that, so i spend 30mins to an hour googling cmd codes that i dont understand and dont work for my build. It’s just not as user friendly for new users as i had hoped. I just wasn’t expecting to spend this much time learning the language.

Hi @daryth84,

first and for all you should read the nextcloud manual:

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/occ_command.html

You can already find out 90% of the answers you would get here. It also comes with a search function.
The positive side effect is that you learn a lot about your server and “surprises” become fewer and fewer every day,


Much and good luck,
ernolf

Thank you!

Nextcloud is a LAMP software and linux users/admins who installed other LAMP software can easy install, configure and repair Nextlcoud, too. The sudo problem is actually quite logical if you know that LAMP is running as the web server user www-data and not root.