My user with NOPASSWD: ALL in sudoers file but still getting prompted for password

Hi, I have my user in the sudoers file, in fedora 41 machine,as follows:
myusername ALL=(ALL) NOPASSWD: ALL

but still when I issue a command using sudo I get prompted for password.

Am I missing any other config?
Thanks in advance

It works for me like this:

sudo tee /etc/sudoers.d/99-local << EOF > /dev/null
%wheel ALL=(ALL) NOPASSWD: ALL
EOF

Correct, this did the job and I was able to sudo without password. But le me ask the question : I need only my user to have this privilege not others, how this can be done?

1 Like

Don’t add other users to the wheel group.

1 Like

I would not give to ALL apps nopassword. You can just give to the most used one like:

myusername ALL=(ALL) NOPASSWD: /usr/bin/dnf, /usr/bin/dnf5, /usr/bin/protonvpn

as an example.
Otherwise you get what we had allready , a root account with no password (mswindows default install).

1 Like

Did you set the file permissions correctly? From the man page:

The sudoers file must not be world-writable, the default file mode is 0440 (readable by owner and group, writable by none).

The file should be owned by root.