1

I am trying to add NOPASSWD option for existing user who belongs to the sudo group and have admin rights. I added this line in sudoers file:

max     ALL=(ALL:ALL) NOPASSWD: ALL

But it still ask me for password when i try to execute command with sudo.

0
8

The sudoers file is parsed line by line and the last rule prevails for a given user.

So, you need to add this rule after all other rules applicable for the given user to have this in effect.

For example, if the user max belongs to sudo group, then the following won't have desired result:

max     ALL=(ALL:ALL) NOPASSWD: ALL
%sudo   ALL=(ALL:ALL) ALL

Reverse the order to get max passwordless sudo access:

%sudo   ALL=(ALL:ALL) ALL
max     ALL=(ALL:ALL) NOPASSWD: ALL
1
  • Or better yet, a new file in /etc/sudoers.d/ (which are parsed at the end of the main file in default configuration)
    – Oli
    Aug 10 '16 at 12:19

Not the answer you're looking for? Browse other questions tagged or ask your own question.