LinuxQuestions.org
Help answer threads with 0 replies.
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 09-18-2006, 07:43 AM   #1
carl0ski
Member
 
Registered: Sep 2004
Location: Melbourne, Victoria Australia
Distribution: Support those that support you :)
Posts: 872
Blog Entries: 12

Rep: Reputation: 30
HDDtemp and normal user


Hi i want to be able to access hddtemp /dev/sda
as a standard user however it doesnt work

Apparently the only way for standard user to use hddtemp is when it's installed as a daemon

Anyone know how to do it?


PS if anyones interested this is a SuperKuramba thee to display CPU mainboard and Nvidia temperatures on your desktop.

Code:
##############################################################
#System Sensors V0.1
#Author: Carl0ski (carl0ski@gmail.com)
#License:GPL
##############################################################
karamba x=0 y=0 w=370 h=330 locked=true 
text x=105 y=35 value="Vital Statistics:" color=255,255,255 fontsize=23 font="sans"


text x=0 y=70 sensor=program program="cat /proc/cpuinfo |grep 'model name'|cut -f2 -d':'" align=left color=255,255,255 fontsize=16


text x=40 y=130 value="CPU temp" color=255,255,255 align=left fontsize=16
font="sans"

text x=40 y=180 value="Mainboard temp" color=255,255,255 align=left fontsize=16
font="sans"

text x=40 y=230 value="Video Card temp" color=255,255,255 align=left fontsize=16
font="sans"


text x=280 y=130 sensor=program program="let cputemp=`sensors | grep 'CPU Temp' | awk '{print $3}'|cut -f1 -d'°'|cut -f2 -d '+'`; echo $cputemp°C" interval=10000 align=left color=255,255,255 fontsize=16

text x=280 y=180 sensor=program program="let mbtemp=`sensors | grep 'M/B Temp:' | awk '{print $3}'|cut -f1 -d'°'|cut -f2 -d '+'`; echo $mbtemp°C" interval=10000 align=left color=255,255,255 fontsize=16

text x=280 y=230 sensor=program program="let g=`nvclock -i|grep 'temperature:' | awk '{print $3}'|cut -f1 -d'C'`;echo $g°C" interval=10000 align=left color=255,255,255 fontsize=16


image x=37 y=160 path="bar1.png"
bar x=41 y=163 w=100 h=0'3 vertical=false path="bar2.png" max=70. interval=10000
image x=37 y=210 path="bar1.png"
image x=37 y=260 path="bar1.png"
 
Old 09-18-2006, 10:31 AM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Debian sid + kde 3.5 & 4.4
Posts: 6,823

Rep: Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947Reputation: 1947
An much easier way is simply to set up a sudo command.

In case you're unfamiliar with how to do it (and for others reading this):

As root, run the command 'visudo' to edit the /etc/sudoers file. Under the "user privilege" section, enter a line for user david as:

david ALL=NOPASSWD: /usr/sbin/hddtemp

And save the file.

Restart the sudo daemon ('/etc/init.d/sudo restart' on Debian. Suse may be a bit different), and you're set.

Now, user david only has to type "sudo hddtemp /dev/hda" to get hda's temperature. You can make it even easier by setting up an alias to make hddtemp="sudo hddtemp" for that user.
 
Old 09-18-2006, 10:38 AM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
You could configure sudo to let the user in question run this program without using the sudo password.

Install sudo if it's not on our system already. Use the visudo program to edit the sudo configuration and add a line something like this:

Code:
# where "matthew" is my username
matthew ALL = NOPASSWD: /usr/sbin/hddtemp
If it's a whole bunch of users you could create a new group and then allow members of that group to execute "sudo hddtemp" without a password, for example:

Code:
# Assuming you created an "hwmon" group, and added 
# all the users you want to access hddtemp to it...
%hwmon ALL = NOPASSWD: /usr/sbin/hddtemp
By the way, I'm assuming the hddtemp program is safe. The specified user(s) will be able to launch this process with root prividiliges, so, as with any program you grant permissions like this to, you should be careful to check that it can't be used to get a shell or do other nasty things.

For more information on the format of the config file, see the sudoers(5) manpage.
 
Old 09-18-2006, 02:40 PM   #4
HappyTux
Senior Member
 
Registered: Mar 2003
Location: Nova Scotia, Canada
Distribution: Debian AMD64
Posts: 3,513

Rep: Reputation: 63
You could set the suid bit on hddtemp that is how Debian does it and it works for normal users so if you wanted chmod +s /usr/sbin/hddtemp it should look like this.

Code:
>$ ls -l /usr/sbin/hddtemp
-rwsr-xr-x 1 root root 29K 2006-09-10 19:14 /usr/sbin/hddtemp
 
Old 09-18-2006, 03:16 PM   #5
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 63
Quote:
Originally Posted by HappyTux
You could set the suid bit on hddtemp
I'm not sure if there is any sort of consensus about it, but I thought suid was considered a little risky and to be avoided when possible... It is simpler than the sudo solution (I for one found the sudoers file format confusing at first), but you lose some of the flexibility.

I guess it's a matter of using whatever is suitable for your environment.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
hddtemp question tgo Linux - Hardware 3 03-21-2006 03:20 PM
Running super user commands as normal user mickyg Linux - Security 5 10-14-2005 07:25 PM
Games runs slow as normal user, but fast as root user mcore Linux - Software 2 06-07-2004 11:11 PM
suse 9.1/ gkrellm hddtemp plugin Goofee Linux - Software 0 05-10-2004 03:52 AM
normal user = super user jayakrishnan Linux - General 4 03-19-2002 09:58 AM


All times are GMT -5. The time now is 09:12 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration