Allow users to shutdown

From ArchWiki
Revision as of 15:08, 14 July 2011 by Roygbiv (talk | contribs) (linking to consolekit)
Jump to: navigation, search

This template has only maintenance purposes. For linking to local translations please use interlanguage links, see Help:i18n#Interlanguage links.

Local languages: Català – Dansk – English – Español – Esperanto – Hrvatski – Indonesia – Italiano – Lietuviškai – Magyar – Nederlands – Norsk Bokmål – Polski – Português – Slovenský – Česky – Ελληνικά – Български – Русский – Српски – Українська – עברית – العربية – ไทย – 日本語 – 正體中文 – 简体中文 – 한국어

External languages (all articles in these languages should be moved to the external wiki): Deutsch – Français – Română – Suomi – Svenska – Tiếng Việt – Türkçe – فارسی

Using sudo

First install sudo:

# pacman -S sudo

Then, as root, add the following to the end of Template:Filename using the Template:Codeline command. Substitute Template:Codeline for your username and Template:Codeline for the machine's hostname.

user hostname=NOPASSWD: /sbin/shutdown -h now,/sbin/reboot

Now your user can shutdown with Template:Codeline, and reboot with Template:Codeline. Users wishing to power down a system can also use Template:Codeline or Template:Codeline.

For convenience, you can add these aliases to your user's Template:Filename (or to Template:Filename for system-wide settings):

alias reboot="sudo reboot"
alias poweroff="sudo poweroff"
alias halt="sudo halt"

Using consolekit

See ConsoleKit for usage with display managers. You can also use dbus for power operations:

  • shut down:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Stop
  • restart:
dbus-send --system --print-reply --dest="org.freedesktop.ConsoleKit" /org/freedesktop/ConsoleKit/Manager org.freedesktop.ConsoleKit.Manager.Restart
  • suspend:
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Suspend
  • hibernate (suspend to disk):
dbus-send --system --print-reply --dest="org.freedesktop.UPower" /org/freedesktop/UPower org.freedesktop.UPower.Hibernate
Note: Using dbus for suspend and hibernate requires Template:Package Official.

Using acpid

acpid can be used to allow anyone with physical access to cleanly shut down the computer by using this power button.