Apache, is a program running in the background. Apache is originally started by user
root (also called
root-process launches several child processes which handle the client requests. For security reasons, the child processes are not run by user
root but as a user with minimal privileges. Usually this user is named
To find out what user this is for apache v1:
ps -ef | grep httpd | grep -v grep
or for apache v2:
ps -ef | grep apache | grep -v grep
Result for apache 2 will be something like this:
root 5001 1 0 07:21 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 5021 5001 0 07:21 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 5022 5001 0 07:21 ? 00:00:00 /usr/sbin/apache2 -k start
www-data 5023 5001 0 07:21 ? 00:00:00 /usr/sbin/apache2 -k start
In this case the user/group is
So, in order to make a directory writable by the webserver we have to set the directory’s owner or group to Apache’s owner or group and enable the write permission for it. Usually, we set the directory to belong to the Apache group (
apache or `www-data or whatever user is used to launch the child processes) and enable the write permission for the group.
chgrp www-data /path/to/mydir
chmod g+w /path/to/mydir
www-data is the name you found with the
ps command above).
2) I've also been told to make the app/runtime directory web-writable. Is this the same as apache writable ?
Yes, this is a directory you need to set writable to the group Apache expects. Probably this will be somewhere in
/var/www/ or it is set as a virtual host in