Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I turn on my machine and I log in to my account I can do whatever I want and even shutdown my machine or say reboot.

But if I open terminal and try to run the command reboot or shutdown then I need to have root access. Why is this so?

I can think of some reasons this kind of behavior like for you may find it desirable for ssh but I am not sure about it, or I can be totally missing some point.

share|improve this question
Check up on dbus and your graphical environtment (e.g. KDE or gnome). – Hennes Sep 20 '12 at 17:08
I think you can do it on every gui, I just want to know why such design feature is there. – Aman Deep Gautam Sep 20 '12 at 17:11
up vote 6 down vote accepted

Its a safety feature.

When using the GUI, you are (typically) sitting in front of the computer you are working on. However, when using a terminal, you might be physically on one machine and remotely using another. You might have many terminal windows open to many different machines. What if you accidentally type reboot in the wrong one? That action could range from an inconvenience to a complete disaster.

By using sudo it forces you to use a password. If you type in the wrong password it gives you an error and hopefully you realize that you are in the wrong terminal. This is why its good practice to have a different root password on every server.

share|improve this answer
I also thought the same but just wanted to make sure that I am not missing something..:) – Aman Deep Gautam Sep 20 '12 at 17:28
Ive seen more than a few Unix admins remove the computer name from their shell prompts because it took up to much space and later regret that decision. – Keltari Sep 20 '12 at 17:33
Note that is not exactly a safety feature in the sense understood here. When Unix started, you only got consoles (no GUI). And only the root user had permission to shutdown/restart. It is still that way. The GUI bypasses using the +s bit in files. Although you can remove those in your menu using these commands:… – Alexis Wilke Dec 27 '12 at 8:50
I just saw my CentOS VM claim "reboot" was not a command when I was su-ed as root. I typed sudo reboot there and it worked. When I directly SSH in as root, reboot works fine. It's weird. – Steven Lu Jul 25 '13 at 5:31
@StevenLu Check your paths. ("echo ${PATH}") It could likely be that an "sbin" directory is not in your path in some cases. In that case, the weirdness might not be with the reboot command. Using "which reboot" might also help to explain. – TOOGAM Sep 28 '15 at 19:14

You can usually reboot from the terminal by pressing Ctrl+Alt+Del. That doesn't work remotely. (Rebooting remotely from the GUI without privileges doesn't work either.)

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .