I'm trying to write a new .rules
file for PolicyKit. My test attempt (in the directory /etc/polkit-1/rules.d/
) looks like this:
polkit.addRule(function(action, subject) {
polkit.spawn(["rm","/home/gabriel/test"]);
if (action.id == "org.freedesktop.policykit.exec") {
polkit.log("action=" + action);
polkit.log("subject=" + subject);
}
return polkit.Result.NOT_HANDLED;
});
But as far as I can tell, this code is never run. The test
file is still there, and there's no log output after running something like $ pkexec -u otheruser bash
(I have tried marking the .rules
files as executable.)
pkaction --version
givespkaction version 0.105
– Roger Binns Mar 24 '16 at 17:38pkaction version 0.105
. New rules files are written in JavaScript unsupported. – Denis Denisov Nov 18 '18 at 22:08.rules
file like in the question? I simply change its extension and move it to/etc/polkit-1/localauthority/
? – Adrian Feb 13 '22 at 15:18121+compat0.1-5
was the first newer version to get out of experimental – Gert van den Berg Nov 07 '22 at 09:25