使用 sudoers.d/ 指令文件

使用 sudoers.d/ 指令文件

您好,我目前正在尝试为 R-PI 上的唯一用户授予运行 pi-hole 应用程序目录中所有命令的权限,而无需使用 sudo 命令。所以我/etc/sudoers.c使用 visudo 命令创建了一个新文件

这是内容

##############################################################################
###############Gives user the ability to run PIhole stuff####################
#############################################################################

user ALL=NOPASSWD: /usr/local/bin/pihole

该文件的 root 模式为 440,visudo -c(检查)解析正常,但我仍然无法访问这些文件。同一用户也在我的 sudousers 主文件中。进行这些更改后我已重新启动。我不确定主文件是否锁定了我在辅助文件中所做的更改

#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults    env_reset
Defaults    mail_badpass
Defaults    secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root    ALL=(ALL:ALL) ALL
user   ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "#include" directives:

#includedir /etc/sudoers.d

该应用程序还有一个 webdata 文件,它似乎在做与我相同的事情。它的设置与我的文件相同,但按预期工作。

# Pi-hole: A black hole for Internet advertisements
# (c) 2017 Pi-hole, LLC (https://pi-hole.net)
# Network-wide ad blocking via your own hardware.
#
# Allows the WebUI to use Pi-hole commands
#
# This file is copyright under the latest version of the EUPL.
# Please see LICENSE file for your rights under this license.
#
www-data ALL=NOPASSWD: /usr/local/bin/pihole

我需要运行以使其提交这些更改的任何命令,我应该查找的任何格式问题。

相关内容