Password prompts continue after adding NOPASSWD for user in /etc/sudoers
Added my userid to /etc/sudoers so I could sudo without password prompts, but password prompts continued. This is because my userid was also member of the "sudo" group, which didn't have the NOPASSWD clause:
sudo sed -n /^[a-z%]/p /etc/sudoers
root ALL=(ALL:ALL) ALL myuid ALL=NOPASSWD: ALL %sudo ALL=(ALL:ALL) ALL
This must be a common problem people have because authors of the sudoers manual page, put the reason right in the description.
When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used (which is not necessarily the most specific match).
So the solution could be any of the following:
- Remove my user from the sudo group
- Add the NOPASSWD clause to the sudo group entry
- Place my user entry after the sudo entry
Whichever method is chosen, must remember to log out of the X session for changes to take effect!