How to get the name of the apache user

10,855

Solution 1

Try

ps aux | grep httpd

or

ps aux | grep apache

The first column of the output is the user that is running the process.

Sample output from a CentOS system

apache    4173  0.0  0.6 239100  6720 ?        S    Aug04   0:00 /usr/sbin/httpd

and an Ubuntu system

www-data  3124  0.0  0.2   6452  2180 ?        S    Aug04   0:00 /usr/sbin/apache2 -k start

On CentOS apache is running as user apache and on Ubuntu it's running as www-data

Solution 2

just see on httpd.conf (usually on /etc/httpd/conf/) grep User httpd.conf

Share:
10,855
UpCat
Author by

UpCat

Updated on September 18, 2022

Comments

  • UpCat
    UpCat over 1 year

    Possible Duplicate:
    Finding out what user Apache is running as?

    I use openSuse and I try to find out the name of the apache user. So I enter

    vim /etc/passwd
    

    in the terminal. Or

    ps -a
    

    Both don't have apache listed. I have mysql and other stuff but apache isn't mentioned. Any ideas?

    ps aux | grep httpd
    

    Output:

    enter image description here

    • user9517
      user9517 over 12 years
      Your apache is running as user wwwrun
    • UpCat
      UpCat over 12 years
      thanks and whats the group for that user?
    • Greg Petersen
      Greg Petersen over 12 years
      Check with groups wwwrun.
    • GuyT
      GuyT over 9 years
      On OpenSuSe it's done by following command: grep -i "^user" /etc/apache2/uid.conf
  • UpCat
    UpCat over 12 years
    the first column is named with root, so is root the apache user?
  • UpCat
    UpCat over 12 years
    I edited my question. habe a look at the output
  • Anarko_Bizounours
    Anarko_Bizounours over 12 years
    no output pal. You messed up the link!