I want to enable a user to run sudo without password. I used visudo to append the line to config file


Yet sudo still asks password as usual. Why?

  • 2
    Add the output of sudo -l. – muru Apr 20 '17 at 9:41
  • 1
    because you have space between NOPASSWD: and ALL - change it to idiot ALL=(ALL) NOPASSWD:ALL and it should be fine – 13dimitar Apr 20 '17 at 9:43
  • I have removed the space, but after sudo -k it still wants a password. – Barafu Albino Apr 20 '17 at 9:46
  • 1
    is idiot a group or a user? If it's a group, the member of idiot must log out/login first. If it's a user - is idiot member of other groups, which require password for sudo? – 13dimitar Apr 20 '17 at 9:50
  • Thanks, I have found the problem. It was /etc/sudoers.d folder not empty, it overrode my config. Thanks for sudo -l tip, it tipped me off. – Barafu Albino Apr 20 '17 at 9:53

Problem solved. I assumed that the line

#includedir /etc/sudoers.d

Is commented out, because the symbol in the front. But no, it is still working and overriding my config. You should add your changes after the line or check the contents of /etc/sudoers.d directory.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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