I need to check if I have an usable polkit agent in a desktop-environment agnostic way.

Right now, what I'm doing is to check if a polkit agent is running, using a code like this:

ps aux | grep some-polkit-agent

where some-polkit-agent may be:

  • polkit-gnome-authentication-agent-1 (for gnome2 and gnome3-fallback)
  • polkit-kde-authentication-agent-1 (for kde)
  • polkit-mate-authentication-agent-1 (for mate)
  • lxpolkit (for lxde)

The "no-fallback" gnome3 (gnome-shell) has its own polkit agent within the gnome-shell process itself, so I can't ps-grep it. What I assume is that if gnome-shell is running then the polkit agent is in place.

The problem comes when a system has hidepid enabled (see http://www.linux-dev.org/2012/09/hide-process-information-for-other-users/). This security measure makes that a ps doesn't show me any polkit agent running even if there is one.

Is there any better way that I can check for an usable polkit agent?


Agents register themselves to the polkit authority over dbus. If you could intercept their dbus traffic you would know exactly what agent is registered.


Based on this forum post, you need to install the policykit-desktop-privileges package.

  • 1
    I don't need/want to install a polkit agent. I need a way to know if there is a polkit agent running. – ivanalejandro0 Mar 2 '15 at 19:06

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.