0

I'm trying to make my sudoers file allow a user to adjust the backlight without having to enter in the password. This is what I have:

# User alias specification
Cmnd_Alias ADJBL = /usr/bin/su -c "echo 150 >/sys/class/backlight/intel_backlight/brightness"

# For our user..
ouruser HOME=(root) NOPASSWD:ADJBL

.. but it doesn't seem to be working, I still get prompted for the password when I try and run that command with sudo. Apparently there is something I'm missing here, any ideas?

2
  • I assume that the alias is evaluated by the shell before the sudo rules are tested - ie, as written you would have to permit no-password access to /usr/bin/su - not ideal.
    – chronitis
    Commented Dec 17, 2012 at 10:54
  • what would be a better way of accomplishing my objective?
    – Eva
    Commented Dec 17, 2012 at 10:56

1 Answer 1

1

Try to make a script and then let the use execute the script wthout password.

Edit:

sudoers:

#User alias specification Cmnd_Alias ADJBL = script.sh

#For our user.. ouruser HOME=(root) NOPASSWD:ADJBL

then into the script:

#!/bin/bash

sudo echo 150 >/sys/class/backlight/intel_backlight/brightness

anf add it to path. this should work.

2
  • how do you mean? the issue is that I cannot use that command without sudo, I want to use this command in a script, this is the reason that I'm trying to add it to sudoers
    – Eva
    Commented Dec 17, 2012 at 10:55
  • Evan, I edited my answer to explain myself better. Commented Dec 17, 2012 at 15:43

You must log in to answer this question.

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