パスワードなしでsudoを再起動できません

パスワードなしでsudoを再起動できません

ユーザーがパスワードを入力せずにシステムをシャットダウンまたは再起動できるように、sudoerを正しく設定しようとしています。私はいくつかのシステムでこれをしましたが、何らかの理由でDebian 10 Busterでは動作しません。

私は考えることができるすべてを試しました:NOPASSWDをデフォルトの%sudoグループに入れ、それを自分のユーザーに直接置き、エイリアスにし、さらにrestart、power off、およびshutdownコマンドへの複数のパスを入れました。効果はありません。

もう心配せずにこの点を説明するために sudoers ファイルをお見せしましょう。

#
# 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
Cmnd_Alias SHUTDOWN=/sbin/poweroff, /sbin/reboot, /sbin/shutdown, /usr/sbin/reboot, /usr/sbin/poweroff, /usr/sbin/shutdown

# User privilege specification
root    ALL=(ALL:ALL) ALL
aren    ALL=NOPASSWD: SHUTDOWN

# 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

注:私はこのファイルを編集するためにvisudoを使用し、エディタを直接使用しませんでした。 visudoは、設定エラーや構文エラー、またはvisudoがいつも言っていることについて文句を言いません。

どんなアイデアがありますか?何か間違っていると思いますか?とても感謝しています。

ベストアンサー1

更新:@KamilMaciorowskiのおかげで問題を解決し、1行の解決策を見つけたので、1行でやりたい人は次のようになります。

%sudo   ALL=(ALL)       PASSWD: ALL, NOPASSWD: </path/to/commands here>

変える: %sudo ALL=(ALL) NOPASSWD: </path/to/commands here>, PASSWD: ALL

なぜなら最後に置いたものが何でも「優先順位」を決めるからです。

おすすめ記事