Pages

Sunday, March 14, 2010

Resetting root Password in Linux

How to reset forgotten root password in Linux?


Quantcast

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.