Resetting root password in FreeBSD

Posted in FREEBSD by edeguzman on September 18, 2010

You might encounter of forgetting your root password in FreeBSD or possibly a lost root password for some reason. I encountered this kind of problem but after googling around, I found ways of resetting root password for FreeBSD.

Below are the procedures I took:

Step 1: Start FreeBSD. Press enter key for FreeBSD boot loader.
Step 2: When FreeBSD’s welcome screen will prompt up, press space bar to pause the booting.Refer to below diagram.
FreeBSD welcome message

Step 3: Type number 4 in the welcome screen. This will boot up in single user mode.
Step 4: Wait until you will be prompted with the below line.

When prompted Enter full pathname of shell or RETURN for /bin/sh:

Step 5: Press entry key to prompt you to the shell.
Step 6: Execute the following commands.

# mount -u /
# mount -a

Note:
If issuing the command mount -u will prompt you “Filesystem not clean – run fsck”.Just execute the command fsck. Then proceed to mount -a. Refer to below error message.
mount -u error message
Step 7: After execution of the above commands. Execute below commands.
This will prompt you to change the root password.

# passwd

Step 8: Reboot FreeBSD or type exit.

# exit
# reboot

This was tested for FreeBSD 7.1 but most likely this will also work for other version
of FreeBSD.

Advertisements

One Response

Subscribe to comments with RSS.

  1. sadotmd said, on September 20, 2010 at 10:48 am

    Worked for me. Thanks


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: