LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 05-02-2007, 10:06 PM   #1
falcon56215
Member
 
Registered: Jan 2002
Location: Tennessee
Distribution: Xubuntu Natty on Lenovo R61i Thinkpad
Posts: 108

Rep: Reputation: 16
Running a command as root


I have GKrellm running on my system, and have created two buttons to change the throttling of the CPU. The two buttons execute the commands:

/home/falcon56215/CPUpowersave.sh
/home/falcon56215/CPUperformance.sh

which are script files that contain the following commands:

echo 'powersave' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

echo 'performance' > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

The problem is these can be executed as root and work fine, but when I execute as a regular user like GKrellm does, I get:


[falcon56215@TuxBox ~]$ ./CPUperformance.sh
./CPUperformance.sh: line 1: /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor: Permission denied

I have tried chmod 4755 CPUperformance.sh, and it is owned by root, but I still get the same error. Any ideas?
 
Old 05-02-2007, 10:22 PM   #2
slakmagik
Senior Member
 
Registered: Feb 2003
Distribution: Slackware
Posts: 4,113

Rep: Reputation: Disabled
The permissions don't change the effective user ID - the scripts still have the same capabilities you do. You'd either need to make them set UID root (and I'm not even sure you can do that with scripts - on some *nixes you can; some you can't) or you'd need to assign the button action to an 'su -c SCRIPT' or sudo or whatever. And, actually, that'd need to be 'xterm -e su -c' or use something like kdesu or whatever it's called. At least, that's what I'm thinking, though there may be other/better ways or other issues.
 
Old 05-02-2007, 11:15 PM   #3
falcon56215
Member
 
Registered: Jan 2002
Location: Tennessee
Distribution: Xubuntu Natty on Lenovo R61i Thinkpad
Posts: 108

Original Poster
Rep: Reputation: 16
OK,

I figured it out. I just inserted a command in startup to chmod 777 /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor and everything works fine.

Thanks,
Danny
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Am I running as ROOT? wardialer Linux - Security 3 04-25-2005 01:31 PM
How could I tell if Im running as ROOT? wardialer Linux - Security 9 03-19-2005 09:47 PM
running as root murray_linux Slackware 4 11-11-2003 07:30 PM
installed as root, running as non-root? daniela Linux - Newbie 4 09-09-2003 04:41 PM
command running on cd in Daem0hn Linux - General 3 07-22-2003 03:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 04:38 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration