Why do I need to be root to shutdown/reboot my computer from the terminal? Doing so via the GUI menu doesn't require root privileges.
closed as not constructive by HackToHell, soandos, Dave, Ƭᴇcʜιᴇ007, 8088 May 1 '13 at 16:34
As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. If this question can be reworded to fit the rules in the help center, please edit the question.
Usually the OS launches at startup a service that runs as root, and offers to desktop environments some possibilities regarding the computer. Usually it's either ConsoleKit or systemd-logind.
For example in KDE you can shutdown your computer from command line as a normal user with something like:
This is possible because the KDE session manager will contact a DBus service that runs as root and when called will run the
On systems running ConsoleKit, you can use:
On systems using systemd-logind, the
To summarize, you can shutdown your computer as a normal user because the Desktop Environment runs a service that offers the possibility to run the shutdown command as root.
 Actually the service does other things to ensure that the Desktop Environment shuts down correctly.
Imagine your computer is a shared webhosting server, where every user is granted SSH access. There are about 500 users per one server in such setup.
Should anyone really be allowed to reboot the entire server, disrupt HTTP downloads, break SSH sessions, etc?
Some reasons from top of my head:
In addition to the GUI menu, you can also shut down Linux from the text console. What it has in common with the GUI is that the user issuing the command almost certainly has physical access. (For the exceptional situations where this is not true, like public kiosks, it can be disabled.)
The user of an arbitrary TTY session cannot be assumed to have physical access; it is a form of remote access. There is no way to signal a shutdown through an arbitrary TTY session, whether it be a local xterm, an actual terminal on a serial line, or an ssh session. You have to prove that you have privilege equivalent to physical access by becoming root.
If unauthenticated or unprivileged users could remotely reboot the system, that would be a security issue.
Just like remote login, a physical terminal (actual serial port) is a form of remote access. The user could be in another building, or in another part of the world (via modem).
A graphical terminal emulator like xterm isn't remote, but the operating system doesn't know that. The application is implemented using a pseudo TTY. This is a virtualized TTY device which the operating system (for the most part) does not distinguish from a real tty. If you type
(Not sure what "the terminal" refers to in the question; there is no such thing in Linux.)