I learned that for granting root permissions to certain programs that it is easer and more constructive to use a separate file.
sudo must be told to look in a separate directory in its configuration to be able to do so.
Likely all distributions have this available and it will be listed at the end:
# is necessary. Also the trailing forward slash is likely necessary (I had to add it); when it wasn’t added, files in
/etc/sudoers.d/ would not always get recognized.
Here’s my configuration built from an excellent tutorial in the Ubuntu forums. I usually build these per user naming them
# Allowed root permissions of programs for user USER # Aliases Host_Alias HOST = aspire Cmnd_Alias G9LED = /usr/bin/g9led Cmnd_Alias IOTOP = /usr/bin/iotop Cmnd_Alias PACKER = /usr/bin/packer Cmnd_Alias PACMAN = /usr/bin/pacman Cmnd_Alias SANDFOX = /usr/bin/sandfox Cmnd_Alias MYPROGS = G9LED, IOTOP, PACKER, PACMAN, SANDFOX # Programs allowed for user or computer todd HOST=(root) NOPASSWD:MYPROGS
The configuration will need to proper-permissions:
sudo chown root:root /etc/sudoers.d/user_<USER> sudo chmod 0440 /etc/sudoers.d/user_<USER>