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]
Advertisements

The URI to TrackBack this entry is: https://sks8.wordpress.com/2009/09/01/reset-forgotten-root-password-in-linux/trackback/

RSS feed for comments on this post.

2 CommentsLeave a comment

  1. This is great for most Linux distributions.

    If you’re using Ubuntu, though, there is no root password. To reset a forgotten user password, you can boot into recovery mode (you do not need to edit any Grub menu entry—recovery mode is already in the list).

  2. “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.”
    How much is realistic?


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: