Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question
    
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 Dec 17 '12 at 10:54
    
what would be a better way of accomplishing my objective? –  Evan Dec 17 '12 at 10:56
add comment

1 Answer

up vote 1 down vote accepted

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.

share|improve this answer
    
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 –  Evan Dec 17 '12 at 10:55
    
Evan, I edited my answer to explain myself better. –  NotFromBrooklyn Dec 17 '12 at 15:43
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.