I understand that with Unix file permissions, there's "user", "group", and "world" octets. For the sake of this discussion, let's assume that setuid/sticky bits don't exist.
Consider the following example:
$ echo "Hello World" > strange
$ chmod 604 strange
$ ls -l strange
-rw----r-- 1 mrllama foo 12 Apr 13 15:59 strange
Let's assume that there's another user, john
, who is a member of my group, foo
.
- What permissions does John have regarding this file?
- Does the system go with the most specific permission match (i.e. John isn't owner, but he's in the
foo
group, so use the permissions for the "group" octet)? - ...or does it go by the most permissive of the octets that apply to him (i.e. John meets the criteria for "group" and "world", so it goes with the more permissive of the two)?
Bonus questions:
- What if the permissions were instead
642
? Can John only read, only write, or both? - Are there any reasons to have strange permissions like
604
?