Apache not allowing me to enter folders belonging to other users

后端 未结 3 675
北荒
北荒 2020-12-12 04:45

I am trying to set up PHP sessions for suPHP (see here). I need to have my php validation file owned by the user so that when suPHP kicks in, it will do so for the correct u

3条回答
  •  無奈伤痛
    2020-12-12 05:06

    I could be wrong, but if suPHP works the way I remember, then PHP is running under the user (in this case user1) not as Apache (www-data), in which case www-data)is the only one with read and write access to the validate file and user1 is not www-data.

    The solution, I think, would be to grant read permission to all for validate and write permission only to www-data. So:

    /var/www/
    └── [drwx------ user1  ]  user1
        ├── [-rwx------ user1  ]  index.html
        └── [dr-x---r-- www-data  ]  validate
            └── [-rwx------ user1  ]  validate.php
    

    With the above, user1 can not edit their validate file, only read it.

    You might also want to try:

    /var/www/
    └── [drwx------ user1  ]  user1
        ├── [-rwx------ user1  ]  index.html
        └── [dr-x-----x www-data  ]  validate
            └── [-rwx------ user1  ]  validate.php
    

    I always confused on how exactly "execute" works, but I believe the idea is that the file can be run (executed) by the user, but not read or written to. But this would require validate to be executable, so if it's a script, that may not work. Someone else here might be able to confirm.

提交回复
热议问题