Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I am attempting to force powertop to run when I log in by using the Startup Applications wizard in Ubuntu. Under the 'Command' entry, I've placed gnome-terminal -x /home/***/Documents/programming/scripts/powertop.sh. It's using a one-line bash shell script:

echo "******" | sudo -S powertop

This inputs my superuser password correctly but doesn't allow me to interact with powertop after it's initialized because it's continuously running echo.

How can I get privileges to run powertop using a shell script, yet still be able to use it in gnome-terminal?

share|improve this question
add comment

1 Answer 1

up vote 5 down vote accepted

Assuming your powertop is in /usr/sbin, you can use sudo /usr/sbin/powertop with no password. To do this you need to run visudo and append the followind line, substituting yourusername with the real one:

yourusername ALL=(root) NOPASSWD: /usr/sbin/powertop
share|improve this answer
    
This works! (And thankfully, I can avoid the security issue of storing my password in a shell script...) –  user15008 Dec 31 '11 at 8:45
1  
@user15008 If this is the right answer can you accept it? –  Michael Mrozek Dec 31 '11 at 9:20
    
Sorry, I had forgotten –  user15008 Dec 31 '11 at 19:39
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.