How to remove the single user mode password in FreeBSD and finally gain root access.
How’s boring, if you are a seasoned IT guy, to play with an OS without being the GOD of it.
I find it extremely boring and frustrating so after weeks spent to play with a virtual appliance and playing the role of the good baby I become naughty 🙂
I’m not an expert of FreeBSD at all so I started to search around and this is the method I used:
- First of all you will need the image of a live Linux distribution. To play on the easy side I used the ‘boot only’ disk of FreeBSD 64 bit (FreeBSD-10.0-RELEASE-amd64-bootonly.iso).
- Boot using this image and when prompted select the option Live CD and log in using the user root. (no password is required)
- Create a directory in /tmp to mount your OS: mkdir /tmp/os
- Mount the / partition of your FreeBSD OS. If for example the OS is the first partition of the first SCSI drive the command should be mount /dev/da0a /tmp/os
- Now you need to modify the /etc/ttys of your OS:
Look for something like:
console none unknown off insecure
and change it to:
console none unknown off secure
- Save the file, unmount the filesystem and reboot this time into the OS choosing the single user mode.
If the FreeBSD menu does not have an option to go in Single User Mode choose the option for the “Escape to loader prompt” and type the command boot -s
- Normally when you boot in Single User Mode the file system is Read Only so issue the command: mount -o update /
- check that your /usr directory contains something, if it is empty type the following command: mount -a
- Finally the bit time is arrived….issue the command passwd to reset the password of root.
- Now you are the GOD of the OS, reboot normally…you have the root access now.
Thanks to the author of this video for the hints. The author is from BSDTutorial.org.
Here is the original video from BSDTutorial.org