Tag Archive for 'dbus'

Shutdown, Reboot, Suspend or Hibernate with user priviliges via D-Bus

Some distros don’t allow you to
shutdown -r now
from terminal without superuser password.
Shutdown/Reboot/Suspend/Hibernate with user priviliges in Linux is possible via D-Bus. You just need consolekit and upower packages installed.

Here are the commands:

Operation D-Bus command
Suspend dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Suspend
Hibernate dbus-send --print-reply --system --dest=org.freedesktop.UPower /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
Reboot dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
Shutdown dbus-send --system --print-reply --dest=org.freedesktop.ConsoleKit /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop

Just paste them in your beloved terminal emulator and press enter :)

Hosted by EOMY.NET