Did You Know?
Donate to TecMint

We are pleased to announce our new TecMint Q/A section to submit your Linux questions

How to Reset Forgotten Root Password in RHEL/CentOS and Fedora

Download Your Free eBooks NOW - 10 Free Linux eBooks for Administrators

In this post will guide you simple steps to reset forgotten root password in RHEL, CentOS and Fedora Linux with example. There are various ways to reset root password which are.

  1. Booting into single user mode.
  2. Using boot disk and edit passwd file.
  3. Mount drive to another system and change passwd file.
Reset Root Password

Reset Forgotten Root Password

Here, in this article we are going to review “Booting into single user mode” option to reset forgotten root password.

Cautious: We urge to take backup of your data and try it out at your own risk.

STEP 1. Boot Computer and Interrupt while booting at GRUB stage hitting ‘arrow‘ keys or “space bar“.

Booting Grub Stage

Booting GRUB Stage

STEP 2. Type ‘a‘ to modify kernel argument. Anytime you can cancel typing ‘ESC‘ key.

Modifying Kernel Parameters

Modify Kernel Argument

STEP 3. Append 1 at the end of “rhgb quiet” and press “Enter” key to boot into single user mode.

Append 1 at the GRUB

Append 1 at the Screen

STEP 4. Type command “runlevel” to know the the runlevel where you are standing. Here “1 S” state that your are in a single user mode.

Command runlevel

Type Command runlevel

STEP 5. Type ‘passwd‘ command without username and press ‘Enter‘ key in command prompt. It’ll ask to supply new root password and re-type the same password for confirmation. “Your are Done” Congratulation!!!

Passwd Command

Type passwd Command

What if GRUB bootloader is password protected? We’ll cover in our next article, how to protect GRUB with password and reset the same. Stay tuned…

If you find this article is helpful, or you may have some comments or query about it please feel free to contact with us through below comment box.

Ravi Saive

Owner at TecMint.com
Simple Word a Computer Geek and Linux Guru who loves to share tricks and tips on Internet. Most Of My Servers runs on Open Source Platform called Linux.

Linux Services & Free WordPress Setup

Our post is simply ‘DIY’ aka ‘Do It Yourself, still you may find difficulties and want us to help you out. We offer wide range of Linux and Web Hosting Solutions at fair minimum rates. Please submit your orders by Clicking Here.

31 Responses

  1. riyas says:

    thanks for this useful info

  2. Raymond DeBrane says:

    are you supposed to remove the 1 to enter single user mode when you are done resetting the root password?

  3. alico says:

    how can i see the other username and password after root pass change ?

    • Ravi Saive says:

      In /etc/password and /etc/shadow file.

      • stefano says:

        Hi ravi , thank you for all useful tutorial …one question , if I can access to the server with different user can I recover the root password ? I have big problem with ssh root login and I am trying to find solution

        Thx

        • Ravi Saive says:

          No you can’t! normal user don’t have rights to recover root password. The only way is using single user mode as described in the article.

  4. Sridhar says:

    Hi

    I tried the same but entered into GUI of Fedora…pl Suggest

  5. ben says:

    Clonezilla is a really handy tool. It’s known as a free imaging tool (COOL) but also features a shell feature which lets you do a lot of sysadmin-y tasks, including something simple like resetting root to things that can be much more complicated . Very handy :) Here’s my video tutorial on using clonezilla just to reset root

    http://geekswing.com/geek/resetting-root-password-on-a-linux-system-using-clonezilla/

  6. Angelo says:

    RAVI!!!

    Thanks, this is the best help i can find in the internet.
    Best regards from Brasil!

  7. shalom says:

    hi im having problem recovering my server root password even after booting to single mode

  8. praveen says:

    thanks, sharing for good information ..

  9. Anon says:

    That was so simple yet helpful, thank you very much! :)

  10. WM says:

    Will this password reset also corrupt my data? Using Centos 6.4 distro.

  11. Elvandar says:

    Will you lose data when resetting the password ?

  12. Tanish madan says:

    i can`t chang the root password. can u help me any one

  13. bikash says:

    Hi,
    I follow up to step-4. As per described here. But in step-5 after giving user command as “passwd” its not asking for new password. Can you help me on this.

  14. Arun says:

    Superb help …cheers.. :D

  15. Amani Musomba says:

    Good Article..

  16. priti says:

    nice article…Its working..

  17. vimal pal says:

    thanx dear..

  18. jad says:

    thank you

  19. GIbson says:

    sir it didnt do anything when i Press ‘a’ on step 2 please reply on this thanks

  20. SRIRAM says:

    Sir,

    How to go single user mode in fedora 20.. and set root passwd Kindly post sir

    • Ravi Saive says:

      Same instructions are used for Fedora 20. Just follow the instructions carefully, you will get single user mode and thereon change or set root password.

      • sanjib says:

        Hi Ravi,

        Its a nice procedure to reset the password.But I have some qus I have my local server and some application is installed.some services are starting with different user and some of the service is starting only through root.If I reset the passwd is it any chances of lossing data?As I can’t login root so I can’t able to take backups.

        • Ravi Saive says:

          No, you will not loose any data, because you are just resetting root password, other than this nothing else…and your services won’t affect too.

Leave a Reply

This work is licensed under a (cc) BY-NC | TecMint uses cookies. By using our services, you comply to use of our cookies. More info: Privacy Policy.
© 2012-2014 All Rights Reserved.