Reset Password root OpenBSD

Sometimes it does happen to us when we couldn’t remember the root password. Specially when we have lot of boxes under our custody.

Actually it is not too hard to recover it.

1. Reboot the machine until it prompts you the boot prompt “boot>”
2. Type boot -s after “boot>” prompt
boot> boot -s
boot -s = The instruction to drop to single user mode
3. You’ll be asked to for shell selection
Enter pathname of shell or RETURN for sh:
4. Terminal type? <>
Terminal type? vt220
5. Run file system check with fsck against you mounting points specially “/” and “/usr” if both in different partition. Mine only has single partition  on /dev/wd0a
example:
fsck /dev/wd0a
6. Mount it. I prefer to mount all, otherwise you can mount it by partition
mount -a
7. Change your root passwd. Make it something easy to remember BUT hard to guess
passwd