[plug] what would this command do if typed as root?

Garry bigbadbill at dingoblue.net.au
Mon Feb 26 06:22:52 WST 2001


Ari..

This is how permissions work.. There are a few simple concepts coming 
together at once here. 

People on the Linux system are divided into three groups. These are root, 
members of a group, and the rest. (There can be many different groups, but 
think about a single group for a file..) 

The number 777 in permissions is not seven hundred and seventy seven. It is 
seven seven seven.

This refers to who is allowed to do _what_ with it. 
The who is the "owner", members of a group, and ordinary users.

The "what" is read the file, write to the file or execute the file.

Back to 777.. Look at 7 in binary. It is 111. If you have 777, in binary this 
is 111 111 111.

The permissions are laid out as 

owner (read, write,execute); group(read,write,execute); user(read, write, 
execute). 

If root, a group or users are allowed to read, write or execute respectively 
that particular file, a "1" is allocated.. "1" means true, or "can do".

Once you remember that the people are always ordered as "owner, "group", 
"user", and permissions for each catagory are always ordered as read, write 
execute (r,w,e), the 777 starts to make sense..  

owner     group       user
r w e       r w e        r w e
1 1 1       1 1 1       1 1 1 


Linux assumes you understand this, and that is why you are provided with a 
command called chmod. 

chmod lets you enter the permissions as a set of three numbers. eg 777.

chgrp allows you to allocate a group to a file. A group might be a group of 
internet users, accountants or students. It just save you from having to put 
in permissions for every user. Users can belong to more than one group.

chown lets you change the group and owner for a file.

As always, use "man chmod" or "info chmod" command to learn more about 
options for these commands.

Hope this helps...

Garry.

I recomend a book - "A practical guide to linux", by Sobell. It explains 
these concepts.





On Fri, 23 Feb 2001, Ari Finander wrote:
> What would 'chmod 777 *.bin' do if I typed it as root from a command
> prompt?  


If obesity, baldness and early death can be effectively treated, why are 
there so many fat, bald dead guys?



More information about the plug mailing list