How to Reset a Forgotten Root Password in Fedora

This brief article explains the steps you can take to reset your forgotten root password on a Fedora Linux system. For this guide, we are using Fedora 32.

Read Also: How to Reset Forgotten Root Password in CentOS 8

First, you need to reboot or power on your system and wait until the grub menu is displayed as shown below.

Fedora Grub Menu

Fedora Grub Menu

Press 'e' to edit the grub parameters. This ushers you to a display shown below. Next, locate the line beginning with 'linux' as shown below.

Locate Grub Kernel Parameter

Locate Grub Kernel Parameter

Using the Cursor forward Arrow key, navigate to the section with the rhgb quiet parameter.

Kernel rhgb quiet Parameter

Kernel rhgb quiet Parameter

Now replace the rhgb quiet parameter with rd.break enforcing=0.

Change Grub Kernel Parameter

Change Grub Kernel Parameter

Next press ctrl + x to boot into single-user mode. Next, remount the root filesystem in read and write mode.

# mount –o remount,rw /sysroot
Mount Root Filesystem in Fedora

Mount Root Filesystem in Fedora

Next, run the command below to gain access to the Fedora system.

# chroot /sysroot

To change or reset the root password simply issue the passwd command as shown.

# passwd
Reset Root Password in Fedora

Reset Root Password in Fedora

Provide a new password and confirm it. If all went well, a notification ‘password updated successfully‘ will be displayed at the end of the console.

To reboot the system, simply hit Ctrl + Alt + Del. You can thereafter log in as the root user using the newly created root password.

Upon logging in, run the command below to restore SELinux label to the /etc/shadow file.

# restorecon -v /etc/shadow

And finally set SELinux to enforcing mode using the command.

# setenforce 1

And this concludes our topic on how to reset a forgotten root password on Fedora 32. Thank you for taking the time on this tutorial.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

James Kiarie

This is James, a certified Linux administrator and a tech enthusiast who loves keeping in touch with emerging trends in the tech world. When I'm not running commands on the terminal, I'm taking listening to some cool music. taking a casual stroll or watching a nice movie.

Your name can also be listed here. Got a tip? Submit it here to become an TecMint author.

RedHat RHCE and RHCSA Certification Book
Linux Foundation LFCS and LFCE Certification Preparation Guide
The Complete Linux System Administrator Bundle
Become an Ethical Hacker Bonus Bundle

You may also like...

1 Response

  1. david says:

    Disabling SELinux does eliminate the need for relabeling the entire drive after a password reset.

    Does this work if the disk is LUKS encrypted? Would you need to run vgchange -a to get access to it?

Got something to say? Join the discussion.

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.