Your cart is currently empty!
How To Reset Root Password In Fedora Linux 42 And Older Versions
Forgetting the root password on Fedora Linux can be stressful, especially if you’re locked out of essential system tasks. Luckily, Fedora provides a way to reset the root password, even if you don’t remember the old one. In this guide, we’ll walk you through the steps to reset the root password in Fedora Linux 42 and earlier versions. This method works whether you’re using a desktop or server edition.
Why Reset the Root Password?
The root password is required for administrative tasks in Fedora, such as installing software or changing critical system settings. If you forget it, you won’t be able to perform these actions. Resetting the password restores access without needing to reinstall Fedora or lose your data.
Step 1: Access the GRUB Boot Menu
- Restart your Fedora system.
- As your computer boots, press the
Esc
key (or sometimesShift
for older versions) repeatedly to bring up the GRUB menu.
Step 2: Edit the Kernel Boot Parameters
- In the GRUB menu, use the arrow keys to highlight the Fedora entry you normally boot.
- Press
e
on your keyboard to edit the boot parameters. - Find the line that starts with
linux
orlinux16
. It will look similar to:linux /vmlinuz-... root=UUID=... ro quiet
- At the end of this line, append the following:
rw init=/bin/bash
So the whole line should look like:linux /vmlinuz-... root=UUID=... ro quiet rw init=/bin/bash
Step 3: Boot into Single User Mode
- Press
Ctrl + X
orF10
to boot with these parameters. - Your system will boot to a root shell prompt without asking for a password.
Step 4: Remount the Filesystem (If Necessary)
Sometimes the filesystem might be read-only. Remount it as read-write with:
mount -o remount,rw /
Step 5: Reset the Root Password
Type the following command to set a new root password:
passwd
- Enter your new root password twice when prompted.
Step 6: Relabel SELinux Context (For SELinux Users)
If SELinux is enabled (default in Fedora), create a file to relabel all files on the next reboot:
touch /.autorelabel
This step prevents SELinux login issues after changing the password.
Step 7: Reboot the System
Restart your computer by typing:
exec /sbin/init
or simply:
reboot -f
Step 8: Login with Your New Root Password
After rebooting (and possibly waiting for SELinux relabeling), you can log in with your new root password!
Troubleshooting Tips
- If you can’t see the GRUB menu, try pressing
Esc
orShift
earlier during boot. - For some cloud or virtual environments, you might need to attach the disk to another machine and edit
/etc/shadow
manually. - If you see permission errors, double-check that you added
rw
to the kernel line.
Conclusion
Resetting the root password in Fedora Linux is straightforward with access to the GRUB boot menu. These steps work for Fedora 42 and older versions. Always remember to use your root access responsibly and keep your passwords secure. If you have questions or encounter issues, let us know in the comments below!
Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!