How to disable [root] password asking on each CPU frequency scaling change?

Asked by Omar Campagne

In some environments/distributions user must input [root] password for changing CPU frequency scaling.
And in some cases (if computer has a couple CPUs) user must input password for each CPU.
How to disable asking password?

Question information

Revision history for this message
Ivan Zorin (iaz) said :
#1

And thanks again for bug.
I have some thoughts about this.
First, I guess that your hardware has a couple CPUs, right? (so looks like battery-status asking password for each CPU, because unlike cpufreq-applet, battery-status changes frequency scaling not only for first/primary CPU, but for other(s) also).
Second, the point is that when battery-status handle frequency scaling, battery-status doesn't handle rights/permissions/policies and other such stuff - it just ask cpufreq for switching frequency; what's going on next - depends on environment.
For example, in Ubuntu cpufreq-applet not asking password (by default). But if you don't want to input password anymore, there is (at least) two ways (easy way and correct way):
easy way - make /usr/bin/cpufreq-selector binary suid'able by command
# chmod +s /usr/bin/cpufreq-selector
but as you probably know suidable binaries should be as less as possible in system.
So correct way - configure PolicyKit for permit your user to change frequency:

# cat /var/lib/polkit-1/localauthority/50-local.d/org.gnome.cpufreqselector.pkla
[org.gnome.cpufreqselector]
Identity=unix-user:put_your_login_name_here
Action=org.gnome.cpufreqselector
ResultAny=no
ResultInactive=no
ResultActive=yes

So, it's not a bug actually, but I agree that such behavior can be pretty annoying.
I guess that I just should add advice about PolicyKit in a FAQ.
Now, please, try a trick with PolicyKit and let me know, if there is still exists some problems with passwords and authentication.

Revision history for this message
Omar Campagne (ocampagne) said :
#2

Thanks for the interest on a non-bug :)

The policykit trick just works perfectly. I agree that this is not a bug
(now that you explained), but it'll be nice if the
permissions could be remembered till the end of session....
or just write that trick on a FAQ.

Revision history for this message
Ivan Zorin (iaz) said :
#3

> How to disable asking password?

If your distro use PolicyKit, then open terminal, and run:
# gedit /var/lib/polkit-1/localauthority/50-local.d/org.gnome.cpufreqselector.pkla
Paste this text block in file:

[org.gnome.cpufreqselector]
Identity=unix-user:put_your_login_name_here
Action=org.gnome.cpufreqselector
ResultAny=no
ResultInactive=no
ResultActive=yes

and save it. Your login name you can get by running command:
$ whoami

Revision history for this message
Ivan Zorin (iaz) said :
#4

Ivan Zorin suggests this article as an answer to your question:
FAQ #1127: “How to disable [root] password asking on each CPU frequency scaling change?”.

Revision history for this message
Ivan Zorin (iaz) said :
#5

Marked as solved.