blog.up-link.ro android bsd linux unix & open-source world

12Feb/102

How To Recover the root Password in FreeBSD

The password cannot be recovered. The following procedure will allow you to change the root password.

Do the following:

- when the following boot message appears

Hit [ENTER] to boot immediately, or any other key for command prompt.
Booting [kernel] in 10 seconds...

hit a key, just pick one EXCEPT the ENTER key. You'll get a prompt like:

disk1s1a:>

- type the following commands:

disk1s1a:>unload all
disk1s1a:>load kernel
disk1s1a:>boot -s

The boot process will now start, just wait until it asks you for a shell. Just hit
ENTER and 'sh' will be used as shell.

If you type 'mount' you will see that only your root partition ( / ) is mounted, you will have to mount  'usr' partition as well.

#mount /dev/ad0s1f /usr

Now you have to mount root partition as read-write enabled. Use the following command:

#mount -u /

The root partition should now be mounted read-write. Now you can use 'passwd' program to
change the root password.

#passwd

That's all, reboot the system and login with the new password.

Print This Post Print This Post