File Access - Does Owner Access Override Group Access?

Ron Natalie ron at topaz.rutgers.edu
Sat May 21 04:19:14 AEST 1988


>I created a text file in my home directory.  It had read and write access
>for the owner (that's me) and read only access at both the group and world 
>level.  I then did a chmod on the file and gave it 077 as the access mask.
>This gave it full access to both group and world but took away all access
>at the owner level.  I did an ls -gl and a groups command and the file did
>belong to the group of which I was a member.  However, when I tried to cat
>the file, the system returned the message 'Permission denied'.  
>
>Does this mean that owner level access overrides group and/or world access?

In a word, YES.  The if you are the owner, owner overrides everything else.
If you are in the group, then group permissions override the world permission.
Note that on System V, you are only in one group at a time, so the group
must match the processes group for group permissions to apply, for BSD
systems there is a vector of typically eight groups that you can be in
simoultaneously.  Group permissions apply when any of those groups match
the file.

>Even stranger - I next tried to remove the file with the rm command and
>it worked!  

File permissions do not prevent deletion.  Deletion is an operation that
is performed on the directory the file is in.  You have write permission
on your directory evidentally.  Write permission on a directory means
the ability to create and remove files therein.  There is no such function
as writing into the directory itself (as you would right into a file).

-Ron



More information about the Comp.unix.questions mailing list