While setting up a sudo
environment I noticed that the include directive is prefixed with the pound (#) character.
Solaris shows this as:
## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d
The manual (Linux as well as Solaris) states:
Including other files from within sudoers It is possible to include other sudoers files from within the sudoers file currently being parsed using the #include and #includedir directives.
And:
Other special characters and reserved words The pound sign (`#') is used to indicate a comment (unless it is part of a #include directive or unless it occurs in the context of a user name and is followed by one or more digits, in which case it is treated as a uid). Both the comment character and any text after it, up to the end of the line, are ignored.
Does anybody knows why the choice was made to use the pound character in the #include
and #includedir
directives?
As a side note: I often use something like egrep -v '^#|^$' configfile
to get the non-default/active configured settings, and this obviously does not work for the sudoers
file.
#includedir /etc/sudoers.d
as a comment and remove it, making me nearly can't use "sudo" command. Similar things: modeline for vim. Any relationship among them? – Good Pen Apr 04 '22 at 14:45