Title: Resetting passwords in single-user mode on OpenBSD Author: Alex Arch Created: 2025-03-08 Modified: 2025-03-08 Recently I've been careless with my password management, and lost passwords for my openbsd.amsterdam VM. Thankfully, the system is pretty DIY, and I was able to reset them by running the VM in single user mode. It's pretty simple to do, really. Here's how. The below commands are only really specific to openbsd.amsterdam up until the boot prompt. After that it's the same so long as you have a physical (in my case a "physical" serial) connection to the machine. myhost$ ssh myuser@serverX.openbsd.amsterdam serverX$ vmctl status | awk '$7 == "myuser" {print $9}' vmX serverX$ vmctl stop -w vmX && vmctl start -c vmX Wait a bit, and you should get the boot prompt (">"). Quickly type "boot -s": > boot -s Prompted for the path to shell, either just press enter, or type /bin/ksh if you need that. Enter pathname of shell or RETURN for sh: /bin/ksh Finally, you can customise your input. # kbd us.dvorak # set -o vi Remount the root partition as read-write, and mount the /usr partition (you'll need passwd(1), which is in /usr/bin/passwd). # mount -uw / # mount -w /usr If that doesn't work, you might find 'sysctl hw.disknames' and disklabel(8) to be helpful. Regardless, after mounting the necessary partitions, you should be able to reset the passwords and reboot. # passwd root # passwd myuser # reboot If you are on a serial console like me, press ~. (tilde dot), possibly preceeded by Return (Enter) to disconnect.