ConsoleKit – Shut Down System via ConsoleKit DBus Message as User

consolekitd-buspolkit

I found the following command line to shut down a Debian/GNU Linux system

dbus-send \
  --system \
  --dest=org.freedesktop.ConsoleKit \
  --type=method_call \
  --print-reply \
  --reply-timeout=2000 \
  /org/freedesktop/ConsoleKit/Manager \
  org.freedesktop.ConsoleKit.Manager.Stop

It works if I execute the command as superuser, but as a non-privileged user it says:

Error org.freedesktop.ConsoleKit.Manager.NotPrivileged: Not Authorized

I would like to know if it is possible to modify such a command in such a way that, interacting with PolicyKit, it can grant the privilege to shut down the system to a normal user.

Best Answer

According to this Debian bug report, this is due to an upstream change in ConsoleKit between versions 0.4.1 and 0.4.2. The thread contains a few suggestions and workarounds, one of which is to install a display manager (like GDM or lightdm) that talks with ConsoleKit directly.

Related Question