Newer fedora distros keep track of authentication failure attempts.
This may prevent sudo from working even though the password is correct!
In this example, I verified my user ‘ben’ is in /etc/sudoers
# grep ben /etc/sudoers
ben ALL=(ALL) ALL
Yet when I performed a simple operation the password was not accepted
# su - ben
[ben@bedora37]$
[ben@bedora37]$ sudo bash -c ls
[sudo] password for ben:
Sorry, try again.
[sudo] password for ben:
Sorry, try again.
I could verify the password I am using is correct by performing an SSH to localhost
# ssh ben@localhost
password
#
The problem in this case was that I needed to reset the failure lock
# faillock
ben:
When Type Source Valid
2023-04-15 16:33:01 TTY /dev/pts/1 V
2023-04-15 16:33:10 TTY /dev/pts/1 V
2023-04-15 16:33:20 TTY /dev/pts/1 V
root:
When Type Source Valid
I reset via
# faillock --user ben --reset
#
Now my simple ls works
# su - ben
[ben@bedora37]$
[ben@bedora37]$ sudo bash -c ls
[sudo] password for ben:
Desktop Documents Downloads logs Music Pictures Public snap Videos
[ben@bedora37]$