Wednesday, May 19, 2010

Recovering from a forgotten root password

1.Reboot the PC (select Reboot as you log out of the GUI screen) or power up as usual.

Soon you see the graphical GRUB boot loader screen that shows the names of the operating systems you can boot. If your system runs the LILO boot loader, press Ctrl+X and at the boot: prompt, type linux single and press Enter. Then proceed to Step 4.

2.If you have more than one operating system installed, use the arrow key to select Linux as your operating system and then press the A key.

GRUB prompts you for commands to add to its default boot command.

3.Press the spacebar, type the following, and press Enter:
       single
   Linux starts up as usual but runs in a single-user mode that doesn't require you to log in. After Linux starts, you see the following command-line prompt that ends with a hash mark(#), similar to the following:
     sh-3.00#

4.Type the passwd command to change the root password as follows:
    sh-3.00# passwd
    Changing password for user root.
    New password:

5.Type the new root password that you want to use (it doesn't appear on-screen) and then press Enter.

   Linux asks for the password again, like this:
      Retpye new password:

6.Type the password again and press Enter.
    If you enter the same password both times, the passwd command changes the root password.

7.Now type reboot to reboot the PC.
   After Linux starts, it displays the familiar login screen. Now you can log in as root with the new password.

In SUSE Linux, in Step 3, type single init=/bin/sh (instead of single) and before proceeding to Step 4, type mount /-n-0 remount,rw. Then perform Steps 4 through 6 to change the root password. After Changing the password, type mount /n -o remount,ro. Then continue to Step 7 and reboot the PC.

No comments:

Search This Blog