Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I want to run the below command

echo 1000 > /sys/class/backlight/intel_backlight/brightness

i cannot do it it like below beecause bash is the process that actually directs output to the root-owned brightness file.

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

so how would i run this command but i

  • do not want to be prompted for root password
  • do not want to login as root, execute command and exit
  • should use available sudo permissions available for current user to execute command
share|improve this question
up vote 3 down vote accepted

What you're asking is impossible. Your current process is not being run by root, and only the root user can issue setuid. As such, another process has to be launched as the root user first (by using a setuid executable, in this case, sudo).

Here is the closest thing to what you're asking, with the impossible removed:

echo 1000 | sudo tee /sys/class/backlight/intel_backlight/brightness

If you don't want this to prompt for a password, add a line in /etc/sudoers (by using visudo), like so (replace rag with your username):

Cmnd_Alias BACKLIGHT = /usr/bin/tee /sys/class/backlight/intel_backlight/brightness, ! /usr/bin/tee /sys/class/backlight/intel_backlight/brightness *
share|improve this answer
thank you. that works. – rag Feb 24 '13 at 12:50

this works as well. I do not mind being prompted for my own password

sudo bash -c "echo 1000 > /sys/class/backlight/intel_backlight/brightness".

share|improve this answer

Your Answer


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.