Quantcast
Channel: User Kamil Maciorowski - Super User
Viewing all articles
Browse latest Browse all 651

Answer by Kamil Maciorowski for Sudoers NOPASSWD for single executable but allowing others

$
0
0

man 5 sudoers says:

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 you should have these lines exactly in this order:

username ALL=(ALL) ALLusername ALL=(ALL) NOPASSWD: /home/username/script.sh

and any line that also matches (like e.g. %sudo ALL=(ALL:ALL) ALL) should be before the NOPASSWD line.

General note: #include and #includedir allow sudoers to include other files. From the version 1.9.1 the encouraged directives are @include and @includedir respectively, but #include and #includedir are still accepted. Don't let # fool you, these are not comments. While searching for entries that may interfere, you shouldn't omit what #include and #includedir point to. Helpful option: sudo -l.


Viewing all articles
Browse latest Browse all 651

Trending Articles