OpenBSD HACK: Single user mode (reset root password)

If you have forgotten root's password or have mistakenly disabled the shell you used for root and other accounts, you will need to boot into single user mode to fix these problems.

  • Step 1 – Start single user mode
  • Step 2 – Check file systems with fsck (filesystem consistency check)
  • Step 3 – Mount filesystems
  • Step 4 – Reset root password
  1. When you restart the system wait until you see something similar to the below:
    Using drive 0, partition 3.
    Loading…
    probing : pc0 com0 apm mem[634K 319M a20=on]
    disk: fd0 hd0+
    >> OpenBSD/i386 BOOT 2.06
    boot>

    at this point you are going to want to enter into single user mode by typing boot -s at the boot prompt:
    boot>
    boot -s

  2. Now run fsck on the root partition, to make sure things are okay for changes:
    Enter pathname of shell or RETURN for sh: <press return>
    #
    fsck /

  3. Mount all filesystems by typing:
    # mount -a

  4. Reset root's password by typing passwd command and then reboot:
    # passwd
    Changing local password for root.
    New password: **********
    Retype new password **********
    # shutdown -r now

About this entry