Question: 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?

Answer: 
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](http://ubuntuforums.org/showthread.php?t=2211822), you need to install the `policykit-desktop-privileges` package.