You are not logged in.

#1 2009-06-27 17:36:08

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

[SOLVED]hddtemp without sudo

Hello!
Is there anyway of getting hddtemp to work without having to key in the password? I have tried adding

shylock ALL = NOPASSWD: /usr/sbin/hddtemp

Also tried:

%hwmon ALL = NOPASSWD: /usr/sbin/hddtemp

What I'm trying to do is making an alias like I did with gpu temp

alias gpu?='nvclock -i | grep temp'

For Hddtemp as well. Now my only option left is to echo my password and feed it to sudo, which is not a good idea I think. Any help?

Last edited by sHyLoCk (2009-06-28 02:50:47)


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#2 2009-06-27 17:52:41

jordz
Member
Registered: 2006-02-01
Posts: 248

Re: [SOLVED]hddtemp without sudo

%<group> ALL = NOPASSWD: /usr/sbin/hddtemp

or you can do

<yourusername> ALL = NOPASSWD: /usr/sbin/hddtemp

but than you need to run hddtemp with sudo infront of it
I don't think it's smart to give a normal user access to /dev/sda wink

Edit: remember to use visudo!

Last edited by jordz (2009-06-27 17:53:07)

Offline

#3 2009-06-27 18:00:15

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

Eww, this looks ugly.

Another approach is to add hddtemp to your daemons array in /etc/rc.conf and modify /etc/conf.d/hddtemp. Mine looks like:

PARAMS="-q -l 127.0.0.1"
DRIVES="/dev/sda"

Start the daemon as root "/etc/rc.d/hddtemp start", and as normal user run "nc localhost 7634"

Last edited by arkham (2009-06-28 02:17:02)


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#4 2009-06-27 18:00:40

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: [SOLVED]hddtemp without sudo

jordz wrote:
%<group> ALL = NOPASSWD: /usr/sbin/hddtemp

or you can do

<yourusername> ALL = NOPASSWD: /usr/sbin/hddtemp

but than you need to run hddtemp with sudo infront of it
I don't think it's smart to give a normal user access to /dev/sda wink

Edit: remember to use visudo!

Thnx 4ur reply.Hmm I already said I tried that, still asking for password. Temporarily I'm using echo to solve this issue, which is a horrible solution! I need a better one.

arkham wrote:

Eww, this looks ugly.

Another approach is to add hddtemp to your daemons array in /etc/rc.conf and modify /etc/conf.d/hddtemp. Mine looks like:

PARAMS="-q -l 127.0.0.1"
DRIVES="/dev/sda

Start the daemon as root "/etc/rc.d/hddtemp start", and as normal user run "nc localhost 7634"

Yes I did that already. Still says Permission denied without sudo.

Last edited by sHyLoCk (2009-06-27 18:07:18)


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#5 2009-06-27 18:10:56

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

You won't need to start the daemon manually if you put it in the daemons array.


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#6 2009-06-27 18:15:36

brisbin33
Member
From: boston, ma
Registered: 2008-07-24
Posts: 1,796
Website

Re: [SOLVED]hddtemp without sudo

something worth noting, you have to log in/out again for groups and sudoers changes to take affect.  the nc method is better and "works for me" but the visudo method shouldn't ask for a password once you log in/out, if you've typed the line correctly.

Offline

#7 2009-06-27 18:21:10

Army
Member
Registered: 2007-12-07
Posts: 1,784

Re: [SOLVED]hddtemp without sudo

As root

chown +s /usr/sbin/hddtemp

Then as user

hddtemp

and it will work :-) No crappy sudo required. The "downside" is, that with this version EVERY user on your computer can run the command hddtemp and will get a result. You have the choice

Offline

#8 2009-06-27 19:40:10

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

Army wrote:

As root

chown +s /usr/sbin/hddtemp

Adding the suid bit to an executable is always kindof risky though..


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#9 2009-06-27 20:36:27

DevoidOfWindows
Member
Registered: 2009-05-24
Posts: 133

Re: [SOLVED]hddtemp without sudo

Post deleted.

Last edited by DevoidOfWindows (2009-06-28 20:00:09)

Offline

#10 2009-06-28 00:48:59

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: [SOLVED]hddtemp without sudo

I don't think the problem is with /usr/sbin/hddtemp
I'm getting: /dev/sda: open: Permission denied
So, /dev/sda is the problem which is denying access to hddtemp in normal user mode.


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#11 2009-06-28 01:12:45

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

Follow these steps:

1) Run as root

nano /etc/conf.d/hddtemp
PARAMS="-q -l 127.0.0.1"
DRIVES="/dev/sda"

2) Run as root

/etc/rc.d/hddtemp start

3) Run as root

nano /etc/rc.conf

Add hddtemp to the daemons array

4) Run as normal user

nc localhost 7634

Last edited by arkham (2009-06-28 02:15:10)


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#12 2009-06-28 01:31:41

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: [SOLVED]hddtemp without sudo

Hmm why is it not letting me

:: Starting HDDTemp                                                      [FAIL]

I've added to daemons array and rebooted?


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#13 2009-06-28 01:33:11

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

Mmm, are you sure the hard disk is /dev/sda? What is the output of

mount

"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#14 2009-06-28 01:43:22

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: [SOLVED]hddtemp without sudo

Thanks for all your replies. Ok I managed to start it ith another reboot after reinstalling netcat.
nc localhost 7634 shows me :

|/dev/sda|???|ERR|*

Yes it's /dev/sda, I'm getting temperature by using sudo hddtemp /dev/sda
When I try without sudo it says /dev/sda open: Permission Denied.
Here's mount output:

$ mount
/dev/sda5 on / type ext4 (rw)
none on /dev type ramfs (rw,relatime)
none on /proc type proc (rw,relatime)
none on /sys type sysfs (rw,relatime)
none on /dev/pts type devpts (rw)
none on /dev/shm type tmpfs (rw)
/dev/sda1 on /windows type fuseblk (rw,allow_other,blksize=4096)
/dev/sda6 on /home type ext4 (rw)
gvfs-fuse-daemon on /home/shylock/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=shylock)
/dev/sdb3 on /media/Videos type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sdb5 on /media/Misc type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sdb4 on /media/zer0 type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)
/dev/sdb1 on /media/Music type fuseblk (rw,nosuid,nodev,allow_other,blksize=4096)

EDIT:  Ok I dont know what happened now i cant even use sudo?
$ sudo hddtemp /dev/sda

/dev/sda: Permission denied

Last edited by sHyLoCk (2009-06-28 01:56:00)


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#15 2009-06-28 02:16:34

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

Mmm I just realized I made a mistake; /etc/conf.d/hddtemp should contain

PARAMS="-q -l 127.0.0.1"
DRIVES="/dev/sda"

I forgot the closing double quote in my original posts (now edited roll)

Restart hddtemp as root

/etc/rc.d/hddtemp restart

Run as user

nc localhost 7634

Hopefully, it should work now; with this solution, you will never have to use the hddtemp command, just run netcat everytime you want to know the temperature.

Last edited by arkham (2009-06-28 02:20:07)


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

#16 2009-06-28 02:53:07

sHyLoCk
Member
From: /dev/null
Registered: 2009-06-19
Posts: 1,197

Re: [SOLVED]hddtemp without sudo

Thanks arkham, but my PARAMS field was ok, the problem was that I had "chown" hddtemp to my username and it wasn't letting me access /dev/sda. i changed its ownership back to root and now I can use the command you suggested:
nc localhost 7634
to get the temp. smile

Last edited by sHyLoCk (2009-06-28 02:53:25)


~ Regards,
sHy
ArchBang: Yet another Distro for Allan to break.
Blog | GIT | Forum (。◕‿◕。)

Offline

#17 2009-06-28 12:57:00

arkham
Member
From: Stockholm
Registered: 2008-10-26
Posts: 516
Website

Re: [SOLVED]hddtemp without sudo

Oh I see; anyway, glad it worked wink


"I'm Winston Wolfe. I solve problems."

~ Need moar games? [arch-games] ~ [aurcheck] AUR haz updates? ~

Offline

Board footer

Powered by FluxBB