我一直在尝试指定一个我希望在不提示输入密码的情况下运行的脚本。经过一些谷歌和堆栈搜索和一些不同的语法更改后,我仍然无法让它工作。一个奇怪的事情是,当打开sudo visudo
nano打开以编辑文件时。我从未指定nano作为编辑器,但我可能首先用nano编辑了该文件。这会使nano成为默认编辑器吗?如果是这样,可能会导致问题。谢谢你的帮助。
这是我的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:$
# Host alias specification
# User alias specification
# Cmnd alias specification
# User privilege specification
root ALL=(ALL:ALL) ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL) ALL
pat ALL=NOPASSWD: /home/pat/test.sh
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d