How to Reset the root Password
This page has been converted from the Fedora Project Wiki and cleaned up for publishing here on the Fedora Docs Portal, but it has not yet been reviewed for technical accuracy. This means any information on this page may be outdated or inaccurate. Reviews for technical accuracy are greatly appreciated. If you want to help, see the README file in the source repository for instructions.
A root password may be set up while installing Fedora Linux, although it is now suggested to leave the root account locked and use
sudo. There are two common methods to reset the root password if it is forgotten or lost.
In Rescue Mode
Using a Fedora Live Media (USB/DVD/CD)
Changing passwords as root will not prompt for the old password.
While booting the system the GRUB2 menu will be displayed. To boot the system into rescue mode using
bash follow these steps:
Select the boot entry you wish to edit with the arrow keys.
Select the entry you with to edit by pressing e.
Use the arrow keys to go to select the line begging with
Go the the end of that line and include a space and the following
rw init=/bin/bash. [Note] ==== If your disk is encrypted, you may need to add
Press Ctrl-x or F10 to boot the entry
Run the command:
You will be prompted to enter the new root password twice.
Restore the SELinux context and permissions with:
If you do not restore the SELinux permissions, the boot process may fail. You may have to do a hard-reboot and start back at step 1.
Reboot the machine with:
The system may take a moment to boot while SELinux relabels its permissions on the filesystem. If you see the Plymouth boot screen you can press the
ESC key on your keyboard to view the SELinux progress. Once it is complete, your system is ready and your root password has been successfully changed.
To download and create a live USB of Fedora Workstation, follow the instructions on the Fedora USB Live Media Quick Doc.
Boot the Live installation media and choose
From the desktop, open a terminal and switch to root using
su(the system will not ask for a password).
To view your hard drive device nodes, enter
df -Hinto the terminal. For this example we will use
/dev/sda2for the root
If you are using LVM partitions, type:
sudo lvscanand note the
/devpath of your root partition. For this example we will use
Create a directory for the mount point (use the
-poption to create subdirectories):
mkdir -p /mnt/sysimage/boot
/(root) partition (be sure to use the actual device node or LVM path of your root
To mount root on a standard partition scheme enter:
mount /dev/sda2 /mnt/sysimage
To mount root on an LVM partition scheme enter:
mount /dev/fedora/root /mnt/sysimage
Continue the process by mounting
mount /dev/sda1 /mnt/sysimage/boot mount -t proc none /mnt/sysimage/proc mount -o bind /dev /mnt/sysimage/dev mount -o bind /run /mnt/sysimage/run
chrootto the mounted root partition with:
chroot /mnt/sysimage /bin/bash
Change the root password:
Exit out of chroot with:
and exit out of the terminal.
Reboot your system and boot from the hard drive.
Congratulations, your root password has been successfully changed.
If you cannot enter rescue mode because you forgot the Firmware/BIOS password here are some options:
Refer to your computer’s documentation for instructions on resetting the Firmware/BIOS password in CMOS memory.
Temporarily move the system hard disk to another machine, and follow the procedures above to reset the root password.
If you have set a password for your boot loader, refer to Creating and Using a Live Installation Image.
If you want to reset the boot loader password, refer to the instructions on how to Reset the Bootloader Password.