Forget root password?

by Administrator 25. June 2009 19:50

Although this may seem like a small catastrophe to you, it's actually very easy to recover from that situation. What you need to do is to reboot (power on) your system, but on the LILO prompt you should type something like:

LILO: Linux init=/bin/sh rw

Where Linux is the example image name, you should supply the actual data, of course. And same parameters should be provided to GRUB or any other boot loader you might use.

Now, init=/bin/sh part tells kernel to exec shell instead of init. That means that you'll end up with a very limited system, but which is fortunately capable enough for you to bravely type your new root password:

sh# passwd

And don't forget to type rw, too. Otherwise you'll end up with root partition mounted read-only. But, if you do, you can remount it read-write like this:

sh# mount -o remount,rw /

OK, after you have changed your password successfully, it's probably best to remount root partition as read-only and just press reset or power button of your computer:

sh# mount -o remount,ro /

The reason for such "drastic" action is that otherwise, e.g. if you typed reboot at the prompt, your system would try to stop myriad of services that are not actually running when you have booted with the above parameters to the kernel. So the reboot would take longer (it could even get stuck at some point) and the output of all those failed init.d scripts is definitely not for everybody's eyes. :)

Tags: , ,

Add comment

  Country flag

biuquote
  • Comment
  • Preview
Loading

 

My Quote :P

Each morning when I open my eyes I say to myself: I, not events, have the power to make me happy or unhappy today. I can choose which it shall be. Yesterday is dead, tomorrow hasn’t arrived yet. I have just one day, today, and I’m going to be happy in it.

Month List

Page List