User


Syntax: User unix-userid
Default: User #-1
Context: server config, virtual host
Status: core

The User directive sets the userid as which the server will answer requests. In order to use this directive, the standalone server must be run initially as root. Unix-userid is one of:

A username
Refers to the given user by name.
# followed by a user number.
Refers to a user by their number.
The user should have no privileges which result in it being able to access files which are not intended to be visible to the outside world, and similarly, the user should not be able to execute code which is not meant for httpd requests. It is recommended that you set up a new user and group specifically for running the server. Some admins use user nobody, but this is not always possible or desirable. For example mod_proxy's cache, when enabled, must be accessible to this user (see the CacheRoot directive).

Notes: If you start the server as a non-root user, it will fail to change to the lesser privileged user, and will instead continue to run as that original user. If you do start the server as root, then it is normal for the parent process to remain running as root.

Special note: Use of this directive in <VirtualHost> requires a properly configured suEXEC wrapper. When used inside a <VirtualHost> in this manner, only the user that CGIs are run as is affected. Non-CGI requests are still processed with the user specified in the main User directive.

SECURITY: Don't set User (or Group) to root unless you know exactly what you are doing, and what the dangers are.