Hi All, my young son overheard my Fedora password so I attempted to change it using the ‘How to reset the root password in Rescue Mode’ method outlined in the Fedoradocs (How to Reset the root Password :: Fedora Docs). All seemed to go well but when I reboot the system, both my new as well as my old password no longer work. The result is that I cannot login to my system and am currently typing this on my phone. Anyone have any idea what I did wrong here, and how to reset the password so that I can access my system? System is fully up to date running F42. Any help is greatly appreciated!
Hi,
So, did you change the root password or your own user password? Which one doesn’t work?
Sorry, I am a complete noob and have only been using Fedora for about 6 months. The aim was to change my own user password but not sure if this is what I did?
Currently on the Fedora login screen my personal user is listed and neither the new, nor the old password, work. I have no idea how to regain access to my system now. Appreciate the input.
Oh, OK, so it sounds like you have changed the root password, though it’s weird that your own password doesn’t work any more. The link you provided tells you how to change the root password.
You know what user “root” it? It’s the godlike superadmin that can do anything on the system. It exists on all Linux system, though logging in as root may be disabled on some.
Anyway, on the login screen, change your username to root. There should be a button that says “Other”, depending on your desktop environment. I have KDE Plasma so there is “Other” on the login screen. Then type the new password. If you are able to login you will be root (unless it’s disabled), so your desktop will look different and none of your folders and files will be there. Then go to the System Settings and change YOUR OWN password. Do not touch anything else because root has unlimited rights and the system will let you do ANYTHING while logged in as root.
If you can’t log in as root, because it’s disabled, come back.
I use Fedora 42 Workstation. On the login screen it only shows my Username. I can click on ‘Not listed?’. The system then lets me change user. I typed in ‘root’ and it then lets me enter a password. I entered the new password (and the old one), and it doesn’t let me log in. Does this mean that root is disabled?
Not sure, but root is disabled by default on Fedora KDE, I have to enable it during installation. So GNOME is probably the same. It was worth the shot though.
Though, normally setting root password enables the root account at the same time.
OK, so go back to the instructions you linked in your original post. I’m not sure if this is going to work, I’m kinda new to Fedora myself. This time type:
passwd yourusername
This should change your own password. If this doesn’t work (it may be restricted) then you’ll need to wait for someone more experienced with Fedora to help you.
Thanks so much for all the patience and input but unfortunately that didn’t work either. I am still not able to login to my system. Hopefully someone else will be able to assist.
Can you log in by temporarily enabling SELinux permissive mode at kernel level, by adding enforcing=0
to the kernel arguments?
You’re welcome and I’m sorry I couldn’t solve this.
Thank so much for the input. I am very keen to try if that works but I am not sure how to add enforcing=0 to the kernel arguments? How/where exactly do I need to enter that? Again sorry, very new to all of this.
You should follow steps 1-4 from the document referred in your initial post, except that on step 4 you would add enforcing=0
instead of rw init=/bin/bash
.
If you have managed to log in, come back here for further details.
Yes, that worked!! Thanks so much! I am back in now, using the new password that I had created. You’re a life saver! Anything else that I now need to do? Much appreciated!
It looks like you missed step 8 of the guide about relabeling.
In case you didn’t perform step 8, as indicated by @vgaetera above, please do so. That would reset the SELinux security contexts on your system.
Yes, thank you, that was it. I accidentally added ‘autorelabel=1’ all the way at the end of the Grub menu (so at the end of the initrd line) instead of at the end of the linux ($root) line.
It is working now and the new password allows me to login.
Thanks so much for the input everyone!
Set up a safety net.
Make sure root is enabled and make sure you know the password and are able to log in as root from the CLI and from the GUI. Press Ctrl+Alt+F3 at the login screen to get to CLI and try your root login. Press Ctrl+Alt+F1 to go back to GUI.
Additionally/optionally, create another admin user and make sure you know the password and are able to log in.
This will let you troubleshoot issues if something like this ever happens again.