Reset the Root Password on OpenBSD

Last modified: October 7, 2020
You are here:
Estimated reading time: 1 min

Introduction

If you are locked out of your OpenBSD instance and have lost access to the root account, you need to boot into single-user mode and reset the root password. These steps apply to OpenBSD 6.6 & 6.7.

How to Reset the Root Password on OpenBSD

The “Send CtrlAltDel” button in the web console does not work for OpenBSD. You must perform steps 1 and 2 quickly before the boot proceeds.

  1. Click the Server Restart icon.

    Server Restart

  2. Open the the instance web console.

    Vultr Web Console

  3. The second stage boot loader pauses for a few seconds to give you a chance to provide parameters to the kernel.
    Pass the -s flag to boot:

    >> OpenBSD/amd64 BOOT 3.47
    boot> boot -s
    

    If you miss the prompt, you need to restart the server from the control panel and try again.

  4. Enter the pathname of your shell or press ENTER for sh.
  5. Mount the root filesystem read-write.
    # fsck -p / && mount -uw /
    
  6. Change the root password.
    # passwd
    
  7. Type CTRLD to restart the server in multiuser mode.

Want to contribute?

Was this article helpful?
Dislike 1
Views: 540