View Single Post
Old 01-04-10, 09:51 AM   #1
Fuss
Registered User
 
Join Date: Jan 2010
Posts: 2
Default Running nvidia-settings as different user

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).

$
Is support for the above on a road map? Does anybody know a workaround for this?
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+.
$
gksudo fails as well, with and without suid bit on the nvidia-settings binary:
Code:
$ gksudo -u fuss /usr/bin/nvidia-settings -c :0 -tq GPUCoreTemp

(gksudo:27274): Gtk-WARNING **: cannot open display:
$
Fuss is offline   Reply With Quote