~/bin$ cat setbrightness
id
echo $1 > /sys/class/backlight/intel_backlight/brightness
~/bin$ whoami
rag
~/bin$ sudo -l
Matching Defaults entries for rag on this host:
env_reset, mail_badpass, secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin
User rag may run the following commands on this host:
(root) NOPASSWD: /home/rag/bin/setbrightness
(ALL : ALL) ALL
EDIT: /etc/sudoers
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 SETBRIGHTNESS = /home/rag/bin/setbrightness
# User privilege specification
root ALL=(ALL:ALL) ALL
rag ALL=NOPASSWD:SETBRIGHTNESS
# 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
Run command
~/bin$ sudo /home/rag/bin/setbrightness 3000
[sudo] password for rag:
Can someone please point out why the password is prompted when running sudo
for that command?