How to reset forgotten root password in Linux?

The root password for the Linux system can be reset by booting it into the Single User mode which is also termed as Emergency mode or more popularly known as Rescue mode.

If the boot loader installed on your Linux system is GRUB, then please follow the below listed steps to reset the root password.

  • Select the line which specifies the kernel to be loaded.
  • Press the ‘e’ key to edit the entry.
  • Choose second line (the line starting with the word kernel).
  • Press the ‘e’ key again to edit kernel entry
  • Append the letter ‘S’ or word ‘single’ to the end of the line.
  • Press the [ENTER] key
  • Press the ‘b’ key to boot the Linux kernel into single user mode

After the booting process completes, mount the ‘/’ and ‘proc’ partitions using the below listed commands.

# mount -t proc proc /proc
# mount -o remount,rw /

Issue the 'passwd' command to change the root password.

Finally, reboot the system employing the below commands.
# sync
# reboot

If the boot loader installed on your Linux system is not GRUB but LILO, then please follow the below mentioned steps to reset the root password.

  • At the Boot: prompt displayed by the LILO boot loader, type linux single and press the [ENTER] key:
  • Allow the system boot and when it displays the # prompt, type passwd to reset the root password.
  • Finally, reboot the system by issuing sync followed by the reboot command.

Disclaimer

All data and information provided on this site is for informational purposes only. sks8.wordpress.com or skumar.co.nr makes no representations as to accuracy, completeness, currentness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis. Any trademarks, if at all displayed on this blog belong to their respective owners.

Reblog this post [with Zemanta]