Rebooting via dbus

If you ever wondered how your window manager can shutdown or reboot your computer without asking for a root password, then the most likely answer is dbus.

This command will reboot a machine running dbus:

dbus-send --print-reply --system --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Reboot

You can replace “Reboot” with “Shutdown” to power off the machine completely.