Shutdown the computer as a user from X

Shutting down as a user doesn't work out of the box if you are not using one of the big desktop environments. To enable shutdown as user you mus make sure that

  1. dbus is running
  2. consolekit is used.

If you are not using gdm or kdm but xdm or startx, in  ~/.xinitrc  prepend the line starting your window manager with  ck-launch-session , e. g.

exec ck-launch-session icewm-session

Then you can use following commands:


dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop


dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart


dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend

consolekit > 0.4.1

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

to  /etc/pam.d/common-session