Reset CentOS root Password

Nov 20, 2008 Posted Under: Learn, Random

Client gave me a big challenge!!! They lost the CentOS root password…

I has tried for 30mins to recover the password, but still fail… and the big problem is, this office have no internet access!!!

No choice but I have to get this solved… so I walk down and search for a cafe with internet connection and I found this solution.

1. Shut down the machine. (Ctrl+Alt+Del)

2. When it reboot and reach the CentOS boot up screen, then press any key to go into a select menu. Then press “e” and navigate to the second line “grub.conf” line (kernel) and press “e” to edit the line to

  • option 1 : <SPACE> 1 (” 1″) at the end of the line.  OR
  • option 2: <SPACE> S (” S”) a the end of the line OR
  • option 3: add “single” to “ro root=LABEL=/ single”

Then hit “ENTER” and press ‘b’ to reboot.

After it reboot, and stop at ‘#” command line, type “passwd” to create the new root password.

Reboot the machine as usual and access your root with new password.

7 Responses to “Reset CentOS root Password”

  1. wing loon says:

    awesome…u know this trick now, :D

  2. jax says:

    You should say I am lucky to find this trick… else I’ll be spending whole day at the client office just to re-install the system. :D

  3. Thanks a Zillion !!
    We had a admin leaving, and not giving his password.. this did the trick !!

  4. Jamil says:

    You’re the man! Saved my day! Thx a lot.

  5. Andrzej says:

    Great guide, saved me the day ty

  6. Luong says:

    If single mode is set password, how can I to reset?

  7. TORPYDOO says:

    You’re my HERO!!!!! you saved me a hundred bucks. i owe you a round of ice-cold-beer.

Leave a Reply