Fan control WITHOUT sudo?

I have fan control through nvidia-settings working fine, but I have to run it as sudo, otherwise I get the “Connection Refused” error which somewhat makes sense (there is a monitor on one of the GPUs, running gdm but I’m just ssh’ing in so no X running under my uid).

$ nvidia-settings -a “[fan:0]/GPUTargetFanSpeed=90”
Unable to init server: Could not connect: Connection refused

ERROR: The control display is undefined; please run nvidia-settings --help for usage information.

I can just run this with sudo and that works fine, but I want to script this to a user-level script and I rather not chmod -S on the entire nvidia-settings binary.

Actually I wonder how it even works with sudo, if it requires an X-server to attach to? Like I wrote above, I have gdm on one of the GPUs but the other GPU is headless and the sudo nvidia-settings fan control works fine on that as well so obviously it doesn’t need a running X server?

So, is there another trick to let a normal user have permissions to do this in some clever way? Without having an actual X screen setup under that user’s uid? Or -S on the binary is the way to go…

[the reason I need fan control is these card’s (EVGA 3080s) curves refuse to let the fans go over 80% even though the cards start to thermally throttle, I have to force them at 100% when I actually run stuff and then I want to set them back to auto when I’m done]

You would have to copy/append the .Xauthority cookie from gdm to the user (using root).

Thanks I’ll check this out. But like I wrote, gdm is only running on one of the GPUs (showing the login screen), the other doesn’t have a monitor, and yet sudo nvidia-settings work on that other GPU. Weird…

The driver auto-adds anyavailable gpus to an Xserver.