|
|
#1 | |
|
Registered User
Join Date: Jan 2010
Posts: 2
|
Hi there,
Here's what I want to do: I'd like to plot the GPU temperatures I get from the '/usr/bin/nvidia-settings -c :0 -tq GPUCoreTemp' command using Cacti. I'm able to run this command as root and as my personal username (which is the only one really running an X session). However, I need to be able to get the temperature (in other words, to execute nvidia-settings) as user www-data, which is obviously not running an X session. When I do this now, I get following information, as the display cannot be opened: Code:
$ /usr/bin/nvidia-settings -c :0 -tq GPUCoreTemp No protocol specified ERROR: Cannot open display ':0'. ERROR: Unable to query attribute GPUCoreTemp specified in query 'GPUCoreTemp' (no Display connection). $ I guess I could ssh to localhost to my account without a password (only using a key) and return the result but this would compromise security somehow (as the www-data user will have access to the key). Another alternative would be to cron this command and cat the output to a file every x minutes (which is what I'm planning to do if no better alternative can be found). Thanks. *edit: tried the suid bit as well, without luck (see below). Code:
$ /usr/bin/nvidia-settings -c :0 -tq GPUCoreTemp
(process:27049): Gtk-WARNING **: This process is currently running setuid or setgid.
This is not a supported use of GTK+. You must create a helper
program instead. For further details, see:
http://www.gtk.org/setuid.html
Refusing to initialize GTK+.
$
Code:
$ gksudo -u fuss /usr/bin/nvidia-settings -c :0 -tq GPUCoreTemp (gksudo:27274): Gtk-WARNING **: cannot open display: $ |
|
|
|
|
|
|
#2 | |
|
Registered User
Join Date: Oct 2008
Posts: 98
|
At least on fedora it works to add
Code:
www-data ALL= (username) NOPASSWD: /usr/bin/nvidia-settings -c \:0 -tq GPUCoreTemp and then run sudo -u username /usr/bin/nvidia-settings -c :0 -tq GPUCoreTemp as www-data "username" has to be replaced of course |
|
|
|
|
|
|
#3 |
|
Registered User
Join Date: Jan 2010
Posts: 2
|
Thanks Lysius - this solved the problem and is much more elegant than the workarounds I proposed. I hadn't heard about the NOPASSWD option yet.
|
|
|
|
![]() |
| Thread Tools | |
|
|