Score:0

Cannot access dir although user belongs in the group

cn flag

I have a directory named foo that has the following permissions:

ls -dl foo
d---r-x---  3 foobar  staff  96 Sep  1 10:29 foo

While executing groups or id when logged in as foobar I get back a list of groups that contain staff and gid=20(staff) groups=20(staff) respectively. My understanding is that this means I'm a member of the staff group.

However when trying to do ls foo/ I get back Permission denied.

I was under the impression that the r-x permissions will give me right to list the contents of the directory as well as read the files in it. Why isn't this the case? Any ideas?

bac0n avatar
cn flag
most commands will stop evaluating permission as soon as one of the permission classes meets its criteria. For example, if I'm the owner of a file/directory, only the user class will be considered when calculating the effective user right.
bac0n avatar
cn flag
best paste the first part too: The root user can read/write to any file and execute if any of the permission classes have the exec-bit set.
cn flag
Thanks @bac0n. It seems that even if I log in as user `foobaz` that belongs to group `staff` I still cannot `ls` the directory.
bac0n avatar
cn flag
Yes, the *group class* will not be considered or evaluated, because you are the owner (effectively stops the evaluation of the remaining classes: group and other), if you, e.g., were to log in as a different user you should be able to `ls`. The owner can always regain control of its own files, though. so, there is no reason to limit the owner from a security perspective.
cn flag
Thanks @bac0n. If you write this as an answer I can then accept it. Thank you!
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.