DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

DEV Community πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’» is a community of 963,673 amazing developers

We're a place where coders share, stay up-to-date and grow their careers.

Create account Log in
Mohan Upadhyay for The Coders Blog

Posted on • Originally published at thecodersblog.com on

Reset root or user password of linux (Ubuntu/debian) OS

If you accidentals locked-out or want to change the root/user password at any cost - you can reset it.

Side effect & Note: Previous users login.keyring will not work. Hence, you will loss all previously saved wifi/network drives as well as Google Chrome profile settings (until you remember the old password and unlock it).

To reset follow the following steps.

  1. Reboot pc
  2. Hold SHIFT during boot to start GRUB menu
  3. Highlight your image and press E to edit GRUB config (change will reset after reboot)
  4. Find the line starting with β€œlinux”
  5. Append rw init=/bin/bash at the end of that line
  6. Press CTRL + X to continue the boot
  7. Change password with command passwd USERNAME
  8. Reboot with CTRL+ALT+DEL
  9. Log in using the new password

If you want to backup your keyring file to try unlocking it later save the following file:

/home/user/.local/share/keyrings/login.keyring

Top comments (0)

DEV has this feature:

Settings

Go to your customization settings to nudge your home feed to show content more relevant to your developer experience level. πŸ›