Issue: Password seems to be incorrect, but it 100% is correct

Hi, i just switched from Windows to Fedora and am encountering a problem I cannot find a solution to.

When I run a sudo command, the console asks me for a password. I typed in my user password. But it doesn’t work. I tried three fresh install with different passwords, but every time the password seems to be incorrect. This is the output:

[<user>@localhost ~]$ sudo dnf update

We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:

    #1) Respect the privacy of others.
    #2) Think before you type.
    #3) With great power comes great responsibility.

[sudo] password for <user>: 
Sorry, try again.
[sudo] password for <user>: 

Also, if I lock the screen, I cannot access it again. The machine says the password is wrong. But for the love of god, the password is absolutely correct. I also set a simple one without special digits, so that the keyboard layout would not be interfering. But that also didn’t work.

Thanks for your help!

So. If you reboot, then you are able to login?
You face the problem only with sudo and the lock screen?


Something is seriously wrong here. I am thinking of things like: a broken keyboard not recognizing your typing correctly, a change in keyboard layout, user not beeing part of the wheel group, someone (root) messed around with /etc/shadow, failing hard drive, bad memory, bad filesystem where credentials are stored (just brainstorming)…

For testing purposes, how about you change your password using the passwd command? Does it accept your current password??

1 Like

This my be a long shot, but maybe worth checking out.

I had a problem a while ago, where my login screen keyboard layout, was different from my desktop manager layout. This resulted in me being able to login, but not run sudo.


Any details and diagnosis for the OP maybe?

When installing, you didn’t lock the administrator account did you? Also I think you have to check a box in the Fedora installer to make your user an administrator in order to use sudo, I think.

Can you become the root user? Try issuing the su command instead of sudo. If you can become root, it could be the password for root is different than the password for your account.

The lock screen issue, I am not sure how to fix that. Can you test your keyboard with a live ISO?

I’m trying to remember how I figured this out, it was a little while ago, but you could check you login screen manager, and look at the input method. At the time I was using KDE, so there was an option to change the login manager keyboard settings in SDDM.

When I changed this to my actual keyboard I couldn’t login, so I realized I had set my password with an incorrect keyboard during setup.

You didn’t mention what desktop environment you are using, but if its KDE you should be able to see the keyboard layout at the login screen. Once you login go to terminal and run:


You can then make sure this is the same as you SDDM layout.