Re: An elementary question about execution permissions
On Fri, Aug 04, 2006 at 10:45:01AM +0200, Rodolfo Medina wrote:
> Hi, dear all.
> $ ls -l /sbin/shutdown
> -rwxr-xr-x 1 root root 18516 2005-01-04 23:43 /sbin/shutdown
> The above output shows execution permissions for all users: owner (root),
> group (root) and other user on the binary file `/sbin/shutdown'.
> Then why if I try to run that command with:
> $ /sbin/shutdown -r now
> , it says:
> shutdown: you must be root to do that!
> ? Excuse the very basic question, thanks for replies,
The computer has been programmed to lie.
You can run /sbin/shutdown as an ordinary user. But /sbin/shutdown has
been programmed to check what kind of user is running it before it
does anything else. If it finds that an ordinary user is running it,
it displays the message that you saw and quits.
OTOH, if you attempt to run a file for which x mode has not been set
bash: <filename>: Permission denied
I guess someone decided that this is not informative enough for
shutdown. Maybe shutdown does more than give a special message.
Perhaps it also logs your attempt somewhere. If I were admin of
a computer on which there were many users, I would like to know
if a user were attempting to play with shutdown.
Paul E Condon