Home FreeBSD How To Reset Or Recover Root User Password In FreeBSD

How To Reset Or Recover Root User Password In FreeBSD

Change Root User Password From Single-user Mode In FreeBSD

By sk
1,615 views

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 in your keyboard to boot into single user mode.

Boot Into Single User Mode In FreeBSD
Boot Into Single User Mode In FreeBSD

A few seconds later, the following message will appear. Just press ENTER to continue.

Enter full pathname of shell or RETURN for /bin/sh:
Enter Full Pathname Of Shell In FreeBSD
Enter Full Pathname Of Shell In FreeBSD

You are now 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 the following commands one by one:

# mount -u /
# mount -a
Mount Root Filesystem In Read And Write Mode In FreeBSD
Mount Root Filesystem In Read And Write Mode In FreeBSD

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:

passwd

Enter the new password twice.

Reset Root Password In FreeBSD
Reset Root Password In FreeBSD

Once the root password is changed, exit from the single user mode with command:

# exit

Or, reboot your system using the following commands:

# sync;sync
# reboot

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.

You May Also Like

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

This website uses cookies to improve your experience. By using this site, we will assume that you're OK with it. Accept Read More