How To Reset Or Recover Root Password On OPNsense? So for some reason you just forgot the root password for your OPNsense router/firewall and you are now locked out and don’t know what to do!!? Relax as in this article, we will show you how you can recover the password from single user mode.
You can also check our previous guide on how to install OPNsense Firewall on VirtualBox.
Table of Contents
Resetting Or Recovering Root Password On OPNsense
Boot OPNsense into Single User Mode
The first step in recovering lost or forgotten root password for opnsense router/firewall is to boot it to single user mode.
Therefore reboot OPNsense and once it boots, immediately press 2 on your keyboard to switch to Single User Mode from the loader menu as shown in the screenshot above.
After it boots, you will be prompted to select the shell. Press Enter to start /bin/sh.
Mount Root Partition in Read/Write Mode
Before you can reset the password, you need to remount the drives as rewritable.
mount -o rw /
OR to mount all the drives;
mount -a -t ufs
Reset Or Recover Root Password On OPNsense
Once you have mounted the drives, run the following command to reset the root password.
opnsense-shell password
Follow the prompts to reset the password.
Reboot OPNsense
You can reboot the system and log in with new password.
/sbin/reboot
And Voila!! This is how simple it is to reset or recover root password on OPNsense.
rc.initial.password is missing on OPNsense 19.x
Do you know an other solution ?
Hi, can you try the command;
opnsense-shell password
opnsense-shell password works perfectly! thanks a lot!
full path is /usr/local/sbin/opnsense-shell
On latest OpnSense : /usr/libexec/bsdconfig/040.password/password