How to reset root password in Linux

Posted: August 24, 2011 in Linux
Tags: , , ,

To reset the root password, boot into rescue mode or single-user mode, and use the passwd command to reset the root password.

If you are using GRUB as the boot loader

  • select the kernel
  • press the e key to edit the entry
  • select second line (the line starting with the word kernel)
  • press the e key to edit kernel entry so that you can append single user mode
  • append the letter S (or word Single) to the end of the (kernel) line
  • press ENTER key
  • now press the b key to boot the Linux kernel into single user mode
  • you need to mount at least / and other partitions:

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

  • Change the root password, enter:

passwd

  • Finally reboot system:

sync
reboot

If you are using LILO as the boot loader

  • boot: linux single
  • passwd
  • sync
  • reboot
Advertisements

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