sudoers.d/ディレクティブファイルを使用してください。

sudoers.d/ディレクティブファイルを使用してください。

こんにちは、私は現在、sudoコマンドを使用せずにpi-holeアプリケーションディレクトリ内のすべてのコマンドを実行できるR-PI権限を一意のユーザーに付与したいと思います。そのため、/etc/sudoers.cvisudoコマンドを使用して新しいファイルを作成しました。

内容はこれです

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

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

ファイルのルートモードは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

アプリケーションには、私と同じことを行うように見えるWebデータファイルもあります。私のファイルと同じ設定がありますが、期待どおりに動作します。

# 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

これらの変更をコミットするために実行する必要があるすべてのコマンド、見つける必要があるすべての形式の問題。

ベストアンサー1

おすすめ記事