Mohan pd.
Mohan pd. Author of The Coders Blog. Also a professional fullstack javascript developer working with various tech company and client around world.

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

Sep 14, 2019 · 1 min
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