Today, I forgot the FreeBSD 10.2 root user password. I tried hard to remember it, but no luck. I know how to reset the root user password in Linux, however I am new to Unix-like operating systems. I have been using FreeBSD just for a few weeks now. So, I don't have a clue how to do it. After a bit of googling and testing, I did it successfully. Here is the procedure for how to reset or recover root user password in FreeBSD 10.2.
Be mindful that this method will only work if you have the physical access to the server. For remote systems and VPS, you must need the service provider's help. If you have physical access to your FreeBSD server, then follow me.
Power on your FreeBSD server. At the boot menu, press number 2 in your keyboard. Refer the screenshot
Then, the following message will appear. Just press Enter to continue.
Enter full pathname of shell or RETURN for /bin/sh:
Now, you are landed in the single user mode without root user password.
After reaching the single user mode, you need to mount the root (/) file system in read and write mode.
To do so, run:
mount -u /
Now, setup new password to the root user using command:
Enter a new password twice.
Finally, exit from the single user mode with command:
Or, reboot your system using the following commands:
Similarly, you can reset the any user's password in single user mode. To reset the other user's password, for example ostechnix, just use:
And the rest is same as described above
That's it. You now know how to reset the password for root user.
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.