1

I use xfce which came with a polkit action org.xfce.thunar.policy in /usr/local/share/polkit-1/actions/.
This action allow to run thunar as root if you can give the root password.
On debian with pkexec version 0.105, you create a desktop file on the desk like this one :

[Desktop Entry]
Name=Thunar pkexec
Comment=Lance Thunar sous root
Exec=pkexec thunar /
Icon=Thunar
Terminal=false
StartupNotify=true
Type=Application

This way, you get a window like this one :

polkit authenticate

If you give the password you get :

thunar as root

On OpenBSD with pkexec version 0.116, nothing happend.

This 2 versions of polkit don't work the same way.
With version 0.105, on debian, you can create a pkla file to modify the authorizations.
With version 0.116, on OpenBSD, you must create a rules file to run the action.
So I create a rules file to run the action.

cat 30-thunar_pkexec.rules
polkit.addRule (function (action, subject) {
  if (action.id == "org.xfce.thunar")
  {
    return polkit.Result.AUTH_ADMIN;
  }
});

And nothing happen. If i set the return line like this :

return polkit.Result.YES;

I get :

thunar as root on OpenBSD So this work without authentification but it's not what I want.
How to get this authenticate window with polkit 0.116 ?
Thanks.

  • Are you sure the policy file on Debian is in /usr/local/share/polkit-1/actions and not /usr/share/polkit-1/actions? It appears that only /usr/share/polkit-1/actions is supported, even on Linux. There have been calls from users to allow /usr/local/share/polkit-1/actions too, but so far it doesn't seem to have happened (gitlab.freedesktop.org/polkit/polkit/-/issues/51) – echristopherson Dec 8 '20 at 2:37

Your Answer

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

Browse other questions tagged or ask your own question.