How do I set my web server to run as a specific user other than 'nobody'?

This is located in:

/etc/apache2/envvars

And is usually (by default):

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

You can change the user that apache runs as here. You'll need to restart apache for the changes to take.

What you really want is SUEXEC. What you're proposing is rather quick and dirty; it also poses a huge security risk.

What you should really be doing is this.


Have a look at suexec. Alternately you can set the user Apache runs as. This is an excerpt from my httpd.conf

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
#
User www
Group www