16.04 - File in /etc/sudoers.d/ not recognized - Ask Ubuntu


running fresh install of ubuntu server 16.04.1, tried add file in /etc/sudoers.d/ give 1 user root privileges command.

i added file /etc/sudoers.d/servicetest following content:

servicetest = (root) nopasswd: /bin/systemctl status * 

the file /etc/sudoers left untouched. contains #includedir /etc/sudoers.d last line. setup unfortunately not working, when executing appropriate command sudo user servicetest, still asked password. however, if move content of file /etc/sudoers.d/servicetest end of /etc/sudoers, working expected.

what cause of issue? how can files in /etc/sudoers.d/ working?

apparently, files included in /etc/sudoers file must have 0440 permissions security reasons. way root can edit file , owner , members of owner group can read it, making less file used attempt escalate privileges.

you can check requirements on included file on /etc/sudoers.d/readme, 2 other requirements filename shouldn't start . (hidden files) or end ~ (convention backup files).

credits @steeldriver confirming theory , finding /etc/sudoers.d/readme file!


Comments

Popular posts from this blog

download - Firefox cannot save files (most of the time), how to solve? - Super User

windows - "-2146893807 NTE_NOT_FOUND" when repair certificate store - Super User

sql server - "Configuration file does not exist", Event ID 274 - Super User