How to reset 2FA - Lost Access

Hi everyone.

I would like to request some help, please. I did not expect that, but I reset my phone to inicial parameters, and I lost all the 2FA saved in my Microsft Autenthificator App. Then I am not able to access many applications, including my Cyberpanel Servers. I obviously have root access to my server via SSH. Can someone advise me on how to solve this issue?

Thank you in advance!

Connect to sql using the console.
At cyberpanel database, run this query:

UPDATE `loginSystem_administrator` SET `twoFA` = '0', `secretKey` = 'None' WHERE `loginSystem_administrator`.`id` = 1 

That should be it.
Then you can re-enable it.

If something not working tag me (to get email notification) and I can automate it with a quick script for you to use.

Hi @tmoore

Thank you so much for your reply and help. I was trying to learn how to connect a SQL database via command line and/or with some software such as Microsoft SQL Server Management Studio, but unfortunately I was not able to do it. I am very new to databases.

Can you please help me a bit more by pointing out to me the way to do so, or where I can find it?

Thanks a lot!

No problem, from your reply it appeared you had experience with it, that’s why I didn’t wrote a detailed step.

Run this commands, one at a time (it will use the existing password that cyberpanel created, so should be all good):

mysql_password=$(cat /etc/cyberpanel/mysqlPassword)
mysql -u root -p"$mysql_password" cyberpanel -e "UPDATE loginSystem_administrator SET twoFA = 0, secretKey = 'None' WHERE = 1;"

I’m at my phone so the last command may not be fully correct due to the quotes, but give it a go and if doesn’t work I will arrive home in 15min and fix it

@Sapcedor Script made for future usage.

Run this command whenever you want to remove your 2fa :

sh <(curl || wget -O -
1 Like

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