0

My user account, samjaques, belongs to a group sams. I have two folders, both in the sams group. Folder 1 is owned by root, Folder 2 by samjaques. Both have permissions set as ---rwx---. From the terminal (running as samjaques and sams), I can only open Folder 1 but not Folder 2 (Folder 2 gives Permission denied).

My guess is that the system is checking permissions of the user, then the group, then other, and denies permission if the user is denied without checking the group. Is this the expected behaviour, and is there a reason for it?

In general, is it pointless/bad practice to have group permissions higher than user permissions?

2

Yes, if the EUID of the accessing process matches the owning user, only the user permissions are checked. If not, but the process's GIDs match the owning group, then the group permissions are checked. Otherwise the "other" permissions are used. The ball stops at the first identity that matches.

It doesn't make much sense for the user to have less access than the group, since usually the owning user could just change the permissions and give themselves whatever access they like. (barring stuff like SELinux etc.)

But in the case of group vs others, it can sort of make sense: you can deny access to a particular group, while allowing it to everyone else. E.g. for a file owned by someuser:somegroup, with permissions rw----r--, members of somegroup can't access it, but anyone not a member of somegroup can read the file.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.