Have you forgotten the FreeBSD root user password? Worry not! This brief guide explains the procedure to reset or recover root user password in FreeBSD.
This guide is officially tested on FreeBSD 10.2, and FreeBSD 13.1 versions.
Heads Up: Be mindful that this method will only work if you have the physical access to the FreeBSD system. For remote systems and VPS, you may not see the boot menu. In such cases, you need the service provider's help.
Boot Into Single-user Mode
Power on your FreeBSD system. At the boot menu, press number 2 in your keyboard to boot into single user mode.
A few seconds later, the following message will appear. Just press ENTER to continue.
Enter full pathname of shell or RETURN for /bin/sh:
You are now landed in the single-user mode without
root user password.
After reaching the single user mode, you need to mount the
/) file system in read and write mode.
To do so, run the following commands one by one:
# mount -u /
# mount -a
Reset Root Password In FreeBSD
We are now in the single user mode and mounted the root filesystem in R/W mode.
Now, use the
passwd command to set a new password to the root user:
Enter the new password twice.
Once the root password is changed, exit from the single user mode with command:
Or, reboot your system using the following commands:
Similarly, you can reset the password of any user from the single-user mode. For example, to reset the password of a user called "ostechnix", run:
# passwd ostechnix
And the rest is same as described above
That's it. This is how we reset or recover root user password in FreeBSD operating systems.
You may also want to reset the root user password in Linux operating systems such as Arch Linux, CentOS, Ubuntu etc. If so, refer the following link.