How to: OpenBSD reset root password
If you forgot your root password, you can simply reset it. The general procedure for resetting password is as follows (if you are a Linux user, see how to reset Linux root password):
a) At boot> prompt force openbsd to boot into a single user mode
b) Next mount file system in read-write mode
c) Run passwd command
d) Sync file system
e) Reboot and login normally.
Procedure to reset root password
At boot> prompt type boot -s to boot into single user mode:
boot> boot -s
Next you will see a message as follows:
Enter pathname of shell or RETURN for sh:
Just hit [Enter] key to load sh shell.
Next mount / and /usr file system in read-write mode:
# mount -uw /
# mount /usr
Finally set or change the password for root user, enter:
# passwd
Press CTRL+D to boot into multiuser mode or just reboot server:
# reboot
Further reading
- Howto: Recovering grub boot loader password
- Recovering deleted /etc/shadow password file
- 10 boot time parameters you should know about the Linux kernel
- Debian Linux - Grub Boot into single user mode
- Read boot man page
You may also be interested in other helpful articles:
- FreeBSD reset or recover root password
- Start and stop VMWARE VPS / virtual machine guest operating system from command line
- Most Emailed Linux FAQ in 2007
- OpenBSD 3.9 available for download
- New Web based frontend for OpenBSD ports
Discussion on This Article:
Leave a Reply
We encourage your comments, and suggestions. But please stay on topic, be polite, and avoid spam. Thank you very much for stopping by our site!
Tags: forgotten_root_password, mount_command, passwd_command, reboot_command, reset_root_password, single_user_mode



The problem is that this method doesn’t work for many modern distros (like PC-BSD and openSUSE). They ask you for root password at boot time. In BSD, it is controlled, IIRC, by setting ’secure’ in the /etc/ttys file for the tty. Not really sure how it is done in Linux. In openSUSE, there is a /etc/inittab file, and in there is a ‘what to do in single-user mode” comment that includes running /sbin/sulogin. Perhaps if this is commented out?
Another discussion is here:
http://linux.about.com/od/linux101/l/blnewbie3_2_3.htm
This is how you can boot a Live CD and edit the /etc/shadow file to remove the root password.