check apache user

How to Check What User Apache is Running As

Sometimes you may need to find out which user Apache is running as or check what user PHP is running as. Here is how to check what user Apache is running as.


How to Check What User Apache is Running As

It is very easy to find out which user your Apache server is running as.


Linux (All distributions)

In Linux systems, open terminal and run the following command to list the user running Apache processes.

$ ps aux | grep apache2
www-data  1388  0.0  0.1 162184  7634 ?        Ss   Apr29   0:02 /usr/sbin/apache2 -k start
www-data  1297  0.0  0.1 162184  7268 ?        S    Apr29   0:00 /usr/sbin/apache2 -k start
www-data  1398  0.0  0.1 162184  7926 ?        S    Apr29   0:00 /usr/sbin/apache2 -k start
www-data  1402  0.0  0.1 162184  7784 ?        S    Apr29   0:00 /usr/sbin/apache2 -k start

As you can see www-data is the user running Apache server.

You can also open Apache configuration file at any of the following locations, depending on your system and installation.

  • /etc/apache2/httpd.conf
  • /etc/apache2/apache2.conf
  • /etc/httpd/httpd.conf
  • /etc/httpd/conf/httpd.conf
$ sudo vi /etc/httpd/httpd.conf

and look for user directive. Here’s an example of Apache configuration’s user directive with www-root user.

User www-root

Also read : How to Change Default Page in .htaccess


Windows (All version)

In windows, just open Apache configuration file at C:\Program Files\Apache Software Foundation\ApacheX.X\conf\ where X.X is the version number of Apache server, and look for User directive. Here’s an example of Apache server’s user being test_user

User test_user
Group test_user

Also read : How to Change Apache User


Leave a Reply

Your email address will not be published. Required fields are marked *