Thursday, March 5, 2009

Reset FreeBSD root Password

I have various different VMs for testing purposes. I needed to test something on FreeBSD and luckily I already had a VM setup. But, hmmm...I forgot the root password!

So, if you happened to ever forget the root password for one of your FreeBSD servers, fear not, you can reset it! Well, of course if you have access to boot the server into single user mode of course! ;)

The process is quick and painless; select the default shell once in single user mode (/bin/sh). After that just enter these commands to change the root password:


# mount -u /
# mount -a
# passwd


Obviously, if you've used passwd before it'll prompt you for the new password and to confirm. After that, all you need to do is exit or sync;sync; reboot.

That's it. Cheers!

No comments: