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
install -o root -g root -m 0660 /dev/null /etc/sudoers.d/myusername
printf 'myusername\tALL=(ALL)\tNOPASSWD: ALL\n' > /etc/sudoers.d/myusername

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

Think ansible.