How Apache child process execution user writes to data directory

In Ubuntu Apache, after starting with root privileges, the child process that actually receives the request is executed by the user "www-data".

Let's take a look at the actual process with the ps command. Use the grep command to narrow down the apache.

ps -ef | grep apache
root 1624 1 0 Jun05? 00:00:10 / usr / sbin / apache2 -k start
admins 10576 10188 0 13:11 pts / 1 00:00:00 grep --color = auto apache
www-data 115206 1624 0 06:25? 00:00:00 / usr / sbin / apache2 -k start
www-data 115207 1624 0 06:25? 00:00:00 / usr / sbin / apache2 -k start

In the introduction to Ubuntu server construction, we introduce the operation of creating a group "myapp-group" for applications and allowing users belonging to the group to write to the data directory.

If a CGI application exists and is launched by Aapche, use the "www-data" user to write files to this data directory, gpasswd. Add it to the myapp-group group with the command.

sudo gpasswd -a www-data myapp-group

Associated Information