April 20, 2011 · General · Email This Post

Sponsored Link
If more than one person is logged in on your ubuntu system, Ubuntu requires super user authentication when shutting down the computer.This tutorial will explain How can you make shutdown not require admin password

Method 1

Edit the file /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy using your favorite text editor. You will need root permissions.

gksudo gedit /usr/share/polkit-1/actions/org.freedesktop.consolekit.policy

Change the section relating to shutdown when others are logged in from

and the section relating to rebooting when others are logged in from

And that will allow you shutdown and reboot the PC when multiple users are logged in.

Method 2

If you have dbus-send installed, you can shutdown via dbus without the need to escalate to root privileges.

Shutdown:

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

Reboot:

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

Suspend:

dbus-send --system --print-reply --dest=org.freedesktop.Hal \
/org/freedesktop/Hal/devices/computer \
org.freedesktop.Hal.Device.SystemPowerManagement.Suspend int32:1

Hibernate:

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

Via Askubuntu

Sponsored Link

Incoming search terms:

Related posts

3 Comments to “How can you make shutdown not require admin password”

  1. Dani says:

    Put this line in the /etc/sudoers and all people of the group users didnt needs any password for the reboot command.

    [code]%users ALL = NOPASSWD: /sbin/reboot[/code]

    [Reply]

  2. Thomas says:

    you can schedule your shutdowns. I love it. I download all night and shutdown the computer at 7 am.
    sudo shutdown -h 07:00

    requires a password but only when you type the command.

    [Reply]

  3. Kojo says:

    Interesting. Was expecting to see a change to sudo file like Dani gave. Didn’t know about these other alternative methods.

    [Reply]

Leave a Reply