Thursday, 7 June 2012

Linux: how to recover root password

In Linux, if you forget the root password, you can recover it in this way:

  1. Reboot the machine, at grub menu, edit the boot entry for Linux
  2. press 'e' to to edit the entry,
    append " single" at the end of the kernel line
    alternatively, you can also append " init=/bin/sh" at the end of the kernel line
  3. press 'b' to boot Linux into single user mode
  4. now you will be able to log in the system without entering password 
  5. type 'passwd' to reset root password

No comments:

Post a Comment