我有一个用户 user1 不在 sudoers 文件中(也不属于 sudoer 中的组)但仍然可以使用 sudo。这怎么可能 ?
user1~$ groups
user1 www-data
Run Code Online (Sandbox Code Playgroud)
我的 sudoer conf
root ALL=(ALL) ALL
%sudo ALL=(ALL) ALL
#includedir /etc/sudoers.d
user1~$ sudo -l
User user1 may run the following commands on this host:
(ALL) ALL
Run Code Online (Sandbox Code Playgroud)
Mad*_*ter 16
如您所见,您的 sudoers 文件包含上面一行,其中包含来自/etc/sudoers.d. 您可能认为前面的哈希符号是注释,但来自man sudoers:
可以使用 #include 和 #includedir 指令从当前正在解析的 sudoers 文件中包含其他 sudoers 文件。
/etc/sudoers.d/在我们评论为什么 user1 具有 sudo 权限之前,您需要向我们展示所有文件的内容。