我正在尝试运行一个自动调整屏幕背光的脚本,这需要它提升。
因此,我尝试将其添加到我的sudoers文件中,这样我就可以在没有脚本的情况下运行它。
不幸的是,我似乎无法使其发挥作用。
该文件位于/usr/local/bin/backlight.sh
任何提示?我对Linux的这一部分有点新...
的/ etc / 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:/snap/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) ALL
# See sudoers(5) for more information on "#include" directives:
#includedir /etc/sudoers.d
username ALL=( root ) NOPASSWD: /usr/local/bin/backlight.sh
答案 0 :(得分:0)
我怀疑您的用户是"用户名"。更改您的行并替换"用户名"由您的实际用户。
实施例。我的用户很好。 sudoers将是:
nic ALL=(root) NOPASSWD: /usr/local/bin/backlight.sh