0

I'm not the administrator, so I'm not in the sudo list. How can I shut down the computer from command line without sudo? As I can shut down the computer from GUI, I must be able to get the privilege from somewhere... Thanks.

3
  • Most of the answers to that question won't work here, because this user doesn't have sudo access (and so, I assume, no access to edit sudoers to give himself/herself access). Feb 5, 2015 at 1:12
  • 1
    What happens if you press the power button on the case?
    – wlraider70
    Feb 5, 2015 at 3:27
  • @wlraider70 then I can choose from "Lock", "suspend", "restart" or "shut down" in the pop up window using arrow key (or mouse), but this is just like shortcut and still in GUI, not command line...
    – dlz
    Feb 5, 2015 at 22:25

1 Answer 1

0

The privilege to shut down or restart without root is managed by ConsoleKit.

While the mechanism for how this works is changing as a result of systemd and logind, sending the following ConsoleKit message should still work to shut down without root:

/usr/bin/dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
1
  • Thanks for the answer. But my terminal returns: "Error org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.ConsoleKit was not provided by any .service files"
    – dlz
    Feb 5, 2015 at 22:18

Not the answer you're looking for? Browse other questions tagged or ask your own question.