CentOS7 httpd permission denied for write, even with 777 permission

CentOS can be real pain when it comes to permissions.
Even if you set 777 to a folder you still won’t be able to write to it in Apache.
You need to enable it on system level as well:

chcon -R -t httpd_sys_rw_content_t /var/www/vhosts/localhost/httpdocs/files/
chcon -R -t httpd_sys_content_t /var/www/vhosts/localhost/httpdocs/files/
chcon -R -t httpd_sys_content_rw_t /var/www/vhosts/localhost/httpdocs/files/

Now Apache will be able to write to /var/www/vhosts/localhost/httpdocs/files/ and all subfolders.

Write a Comment

Comment