I'm currently working on a PHP server explorer, and I have to determine if a directory is empty or not readable because of insufficient permission.

My web application is running under the user apache, and I can see that my application can access to a folder that it cannot read according to the directory mode.

Permissions look like this:

      ls -al
drwxr-x--- 8   laura   jpGrp   4096 Aug 10 09:40 dir1

Here are the content of jpGrp:

      cat /etc/group | grep "jpGrp"   

Here are the content of apache user :

      grep apache /etc/passwd

Apache is not in root groupe :

      cat /etc/group | grep "root"

var_dump from shell_exec("whoami") php function :

string 'apache' (length=7)

A friend tell me to see the ACL, but there is nothing that could override the standard Unix modes.

So: why can Apache open this directory (dir1)? (That's my question)

closed as unclear what you're asking by Anthon, Archemar, G-Man, taliezin, cuonglm Aug 10 '15 at 9:46

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • add contents of grep apache /etc/passwd. Perhaps apache has a primary group of jpGrp ? – steve Aug 10 '15 at 9:43

> So why can apache open this directory (dir1) ?

I haven't an answer for this, normally it should not be able to.

> It is possible to make a group in a group ?

No, in Linux all group members must be users.

> Or to made a group the owner of a directory ?

Yes, you can assign ownership of a directory to a user and a group via the command chmod myuser:mygroup mydir. The "group" permissions of the directory will be applied to all users which are member of that group.

  • ok, so no group in group (fortunately) ^^. – Lucsartes Aug 10 '15 at 11:06

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