File Access - Does Owner Access Override Group Access?

Dennis G. Rears FSAC drears at ardec.arpa
Fri May 20 00:57:14 AEST 1988


 Charlie Dennett <dennett at kodak.uucp> writes:

->
->I was experimenting with file access permissions and came across the 
->following.  
->
->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?
->
   Yes.   It checks the owner first.  If you are the owner and the
owner permissions say no it does not give you access. If you are not
the owner it then checks the group. if you are in the group and you
don't have group read permissions it will not give you access.
Finally if you are not the owner or in the group it will check the
world permission.  In summary to access a file:

   If owner you must have owner access.
   If in group and not owner must have group access.
   If not owner or group must have world access.

->Even stranger - I next tried to remove the file with the rm command and
->it worked!  
->
   Not really.  rm acts not on the file but the directory.  rm
actually removes the file entry in the directory.  That is why you
can delete a another user's file if you have no permissions on the
file but have write permission on the directory. (like /tmp)

->I tried looking in the manuals for something to explain about access modes
->but have so far been unsuccessful.  Perhaps someone out there could explain
->what is going on.  
->
->The system I am using is a SUN 3/260 running version 4.2 release 3.5.  I do
->not know if this is unique to SUN or not.

    This is common behaviour for most UNIX versions I have worked
with.


Dennis
--------------------------------------------------------------------------
ARPA:	drears at ardec-ac4.arpa	UUCP:  	...!uunet!ardec-ac4.arpa!drears
AT&T:	201-724-6639		Snailmail:	Box 210, Wharton, NJ 07885
Work:	SMCAR-FSS-E, Dennis Rears, Bldg 94, Picatinny Ars, NJ 07806
--------------------------------------------------------------------------



More information about the Comp.unix.questions mailing list