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 \

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.

  • What is your consolekit version? This Debian bug report suggests that an upstream change between versions 0.4.1 and 0.4.2 caused this, but no official solution exists yet. You can read the bug report and see if any of the suggestions work for you. – jw013 Jan 21 '12 at 16:34
  • 1
    @jw013: solved installing lightdm. Turn your comment into an answer and I will accept it. – enzotib Jan 21 '12 at 17:45

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.

| improve this answer | |

If you use consolekit > 0.4.1 (wheezy and newer) this doesn't work any more out of the box. To get it working again add

session optional        pam_loginuid.so

to /etc/pam.d/common-session.

| improve this answer | |

In my case:

  • Debian 8 amd64;
  • fluxbox;
  • startx (without any DM).
  • installed packages:
    • dbus
    • dbus-X11
    • consolekit
    • policykit-1
    • libpam-ck-connector

This solution works good:

Create a custom-actions.pkla file with the following contents:

sudo nano /var/lib/polkit-1/localauthority/50-local.d/custom-actions.pkla

Put this in the file.

[Actions for xbmc user]
| improve this answer | |

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.