File in /etc/sudoers.d file not being read by sudo
Asked Answered
A

1

26

I want to add a user in the sudoers file and I don't want to touch the original /etc/sudoers file, so I added a new file under directory /etc/sudoers.d.

The interesting thing is about the name of the newly added file. Initially, I named the file as sudoers.local, the file never got effective; then I renamed the file as customize, it got effective immediate. The file name sudoers.customize doesn't work either. It seems any file name containing sudoers doesn't work. Someone know the reason? In all three cases, the file has the proper permission -r--r-----.

The OS is 64 bits CentOS 6.5.

Admit answered 8/2, 2014 at 1:35 Comment(0)
A
72

From the sudoers man page:

The #includedir directive can be used to create a sudo.d directory that the system package manager can drop sudoers rules into as part of package installation. For example, given:

#includedir /etc/sudoers.d

sudo will read each file in /etc/sudoers.d, skipping file names that end in ‘~' or contain a ‘.' character to avoid causing problems with package manager or editor temporary/backup files.

Arboreous answered 8/2, 2014 at 1:50 Comment(1)
I had used file.conf and never realized that was causing the problem. Thanks so much!Mukund

© 2022 - 2024 — McMap. All rights reserved.