0

/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

h ALL=NOPASSWD: /usr/bin/brightlight -i 20 -f /sys/class/backlight/amdgpu_bl0

But doing the command still gives me a permission error.

h@pop-os:~$ brightlight -i 20 -f /sys/class/backlight/amdgpu_bl0
brightlight: could not open "brightness" file: Permission denied

Also

h@pop-os:~$ sudo -l
Matching Defaults entries for h on pop-os:
    env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin\:/snap/bin

User h may run the following commands on pop-os:
    (ALL : ALL) ALL
    (root) NOPASSWD: /usr/bin/brightlight -i 20 -f /sys/class/backlight/amdgpu_bl0

Things I have tried:

  • Rebooting
  • Creating a file in /etc/sudoers.d/brightlight with last line of config above

EDIT: Fixed, you need to add sudo, and it won't prompt you for a password

1 Answer 1

3

Your entry in /etc/sudoers means that you can run

sudo brightlight -i 20 -f /sys/class/backlight/amdgpu_bl0

without being asked for a password. It doesn't mean you can run

brightlight -i 20 -f /sys/class/backlight/amdgpu_bl0

without sudo.

1
  • I've got a similar question here could you pop in to assist? This question came up in a search, and I've read some man pages but I want to be sure I'm doing this correctly since as you know, bad edits could lock me out.
    – BingBong
    Jan 11, 2020 at 19:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .