Sunday, March 29, 2015

Change forgotten password in linux using initramfs

If you have been encountered with a linux box and you can't remember the password or just desperately need to get into the box, here is an easy way of doing so without using any external tools.


  1. Reboot the box
  2. Hold down the shift button upon starting up so you get into the grub menu
  3. Press the "e" key to edit the first option in the menu
  4. Append "break=init" to the end of the line that contains the linux boot parameters
  5. Press F10 to boot using the edited grub script
  6. You should now be prompted with the initramfs user handle
  7. The partition that was mentioned in the grub menu is mounted, but in a readonly state
  8. /bin/mount -o remount,rw /
  9. passwd user
  10. exit
  11. exit
  12. You can now reboot normally and login as the user with the password you just changed

1 comment: