0
policykit-1 version 0.105-17

I cannot seem to make the policykit rule work. All I want is to let anyone be able to run systemctl daemon-reload in the system (for test purposes).

I found the action name for this task from the file org.freedesktop.systemd1.policy as org.freedesktop.systemd1.reload-daemon. I have dropped in a simple rule as following:

/usr/share/polkit-1/rules.d/01-umut.rules

polkit.addRule(function(action, subject) {
        if (action.id == "org.freedesktop.systemd1.reload-daemon") {
                    return polkit.Result.YES;
            }
});

I am expecting this rule to allow anyone run this action but that is not the case.

I have run policykit form the command line as sudo /usr/lib/policykit-1/polkitd and used polkit.log("Hello my rule"); in my rule just to see if the rule ever gets executed and no luck there either.

What am I missing?

1

If PolKit version < 0.106, there are no .rules files but only old .pkla and .conf files.

You can check version of Polkit by: pkaction --version

0

Seems like the version I am using has a bug. I have switched to 0.113-5 version on debian and it worked like charm.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.