Why do I sometimes need to authenticate and sometimes not?

Asked by flrtx

What always bothered me was that sometimes I need to authenticate for performing some actions and sometimes not. I'll give you two examples:
1. If I reboot using the GUI, I don't get prompted for my password, if I type 'reboot' in the terminal, I get a message that tells me only sudo can do that. So I have to type in my password.
2. If I plug in a USB stick, it automatically gets mounted, if I want to mount a partition using the command line or Truecrypt, I get prompted for my sudo password.

I always got the response that rebooting, shutting down, mounting etc. were root actions only sudo could perform but this raises the question: How can I perform them without typing in my password (which obviously is the case in both examples)?

Question information

English Edit question
Ubuntu Edit question
No assignee Edit question
Solved by:
George Standish
Last query:
Last reply:
Revision history for this message
Best George Standish (george-standish-deactivatedaccount) said :


Welcome to the smoke-n-mirrors of linux.

1 - If you reboot using the GUI, it's actually using GDM (assuming you are using Gnome) to handle the rebooting / shutdown / etc. Users don't perform the actions, GDM does ;) When you are in the terminal, you are running as your user and thus cannot directly perform a shutdown etc.

2 - When you plug a USB in, it's handled by GVFS (Gnome virtual file system) and will be mounted in the users home directory under .gvfs - if you type "mount" while one of these is mounted, it won't show up as a "true" mount point. Back to terminal world, only the root account can mount/unmount a device.

Best of luck,

Revision history for this message
flrtx (fltrx) said :

Thanks, George!

Typing in my password will still annoy me but at least now I know why I'm doing it :)

Revision history for this message
flrtx (fltrx) said :

Thanks George Standish, that solved my question.