Enabling Multi-Factor Authentication in OPNsense got me LOCKED OUT

Started by sjhappyman, April 14, 2024, 01:37:20 AM

Previous topic - Next topic
Hello everyone,
I am new to learning about OPNsense. I got my Protecli 4 port box, installed OPNsense, ENJOYED for a few days and then I got myself in trouble. Today, I was trying to implement Multi-Factor Authentication following this tutorial: https://homenetworkguy.com/how-to/enable-multi-factor-authentication-in-opnsense/
I did follow everything in detail, and when did the final part using the tester, I got a red warning that was not working. I ignored that and rebooted the firewall thinking will going to fix the problem. Well, now, I am stuck at the login page of the firewall access and when entering the username and password got "Wrong username or password.".
Can please someone help me to get back access to my OPNsense so I can go back to normal?
Thank you so much for your time and help!

Do you have root access to the console? From the root shell you can pick option 13 to restore a backup config.

Hi Zan,

I disabled root login a few days ago. I created an admin user to have better login security. I am new to Opnsense and I did not create any backup file.
All I did so far was network segmentation and some firewall rules between the subnets.

Do you think it will be easier to just reinstall opensense and start from scratch?

Thank you for your help!

You can try restoring a backup config if you have access to boot menu.
Hit 2 on boot menu to enter single mode, hit enter for shell, then remount your root filesystem rw
Quotemount -u -o rw /

Look for backup config in /conf/backup and pick the one before the time you broke it, copy it over to /conf/config.xml (overwriting) and reboot.

You can also reset root to its default behavior:
Quoteopnsense-shell password

Zan,


I do have access to boot menu. I choose option 2. Then the screen got stuck (see pic) and nothing happens when hitting enter.

Oof, maybe try different keyboard if you have a spare or different usb port.

Thank you, Zan!
I just reinstalled Opnsense and got back to normal.