Lost root password?

Sometimes it so happens that we forget root password. And even more painful thing is that when we boot in a single user mode, with a hope that it will give us a root prompt, it also asks for a password.

To get rid of this problem, do the following:

  • When the GRUB prompt shows up, instead of letting it boot, select the kernel and edit it.
  • At the kernel command line, instead of giving single, give init=/bin/sh. This makes the kernel to start sh instead of the actual init process. Note that parameters like single etc. should not be given because sh does not understand them resulting in a panic.
  • When the root prompt shows up, give a passwd command and change the password.

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 )

Google+ photo

You are commenting using your Google+ 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 )


Connecting to %s