Apache/CentOS 7: /var/www/html/ owned by root but created files owned by apache - how do I resolve this? Apache/CentOS 7: /var/www/html/ owned by root but created files owned by apache - how do I resolve this? apache apache

Apache/CentOS 7: /var/www/html/ owned by root but created files owned by apache - how do I resolve this?


Check your /etc/httpd/conf/httpd.conf file and search for user and group [e.g. User apache Group apache]. Those are the owners by default. In your website there is no need too add write permissions for files and folders assigned to user:group, but you can set readable by owner and others in order to be accessible via web.

Updated answer:The main reason DirectoryRoot (/var/www/html) owned by root is security. You can leave root as owner of files and set group to apache. Regarding security you make sure apache group has read-only access to files [-> One first meassure]. The security is not an illusion. While files are owned by root and do not have rw access from others, it is hard for external attackers to gain write access to files [because this is the most common way to hijack a site].