On the entire directory with the sites, I set 777 ugo=rwx ( ugo=rwx ), and the owner of www:data ( apache , php works under it).

I still can not delete and write files in php .

Why is that?

ps I found something about the Access Control List , but I didn’t figure out what exactly needs to be done. I would also like everything to work with the rights 755 ( u=rwx,go=rx ).

  • one
    recursively change permissions and ownership: 1. directories: sudo find /path/to/docroot -type d -exec chmod u=rwx,go=rx {} + 2. files: sudo find /path/to/docroot -type f -exec chmod u=rw,go=r {} + 3. affiliation: sudo chown -R www:data /path/to/docroot - aleksandr barakin
  • one
    Probably, an error occurs when attempting to write to files that are outside of the docroot . The logs should contain the full path to the files that caused the error. - aleksandr barakin
  • one
    acl : to be able to set permissions on their ( acl ) basis, the partition must be mounted with the acl option. see the output of the mount | grep acl mount | grep acl . - aleksandr barakin
  • one
    such things as selinux , apparmor , etc. can also block access. if this is not a redhat -main distribution, then most likely nothing of the above is worth it. - aleksandr barakin
  • one
    By the way, now glanced at his first comment. www;data copied there, apparently, from your question. and should be www-data:www-data . - aleksandr barakin

1 answer 1

recursively change the rights and ownership can be, for example:

  1. directories:

     $ sudo find /path/to/docroot -type d -exec chmod u=rwx,go=rx {} + 
  2. files:

     $ sudo find /path/to/docroot -type f -exec chmod u=rw,go=r {} + 
  3. affiliation:

     $ sudo chown -R www-data:www-data /path/to/docroot