I wanted to allow my ordinary user to run
/usr/bin/brightnessctl
to turn on/off the keyboard backlight on my laptop, so I did
visudo -f /etc/sudoers.d/grove
(grove
is my username, but all that matters here is that that file is included in /etc/sudoers
)
That file already contained these lines:
grove ALL=(ALL) NOPASSWD: /usr/bin/light -A 5
grove ALL=(ALL) NOPASSWD: /usr/bin/light -U 5
so I just mimicked those and tried adding
grove ALL=(ALL) NOPASSWD: /usr/bin/brightnessctl -d tpacpi::kbd_backlight s 2
grove ALL=(ALL) NOPASSWD: /usr/bin/brightnessctl -d tpacpi::kbd_backlight s 0
but that make visudo
report a syntax error:
/etc/sudoers.d/grove:3:59: syntaksfejl
grove ALL=(ALL) NOPASSWD: /usr/bin/brightnessctl -d tpacpi::kbd_backlight s 2
^~
/etc/sudoers.d/grove:4:59: syntaksfejl
grove ALL=(ALL) NOPASSWD: /usr/bin/brightnessctl -d tpacpi::kbd_backlight s 0
^~
(syntaksfejl
is Danish for syntax error
, I have LANG
set so everything speaks Danish, and I see no reason to redo it with LANG=C
to provide an error in english for such little text)
What is wrong here? Is it the colons (and the indicator being wrong, which might be caused by a TAB after grove
), and if so how can I allow that command? Should I just allow /usr/bin/brightnessctl
and accept that I can control more things?
(If it matters, I'm working on a Debian 12)
Asked by Henrik supports the community
(5878 rep)
Jan 12, 2024, 03:27 PM
Last activity: Feb 3, 2024, 09:58 AM
Last activity: Feb 3, 2024, 09:58 AM