2

I ran the following command, when logged into my shared Linux host to see what user Apache was running as:

ps aux | egrep '(apache|httpd)'

And it was the same user that I use on the server.

ie.

myuser@example.com [~/public_html]# ps aux | egrep '(apache|httpd)'
myuser  44904  0.0  0.0  61244   724 pts/0    S+   15:43   0:00 egrep (apache|httpd)

Is that standard for shared hosts? On my development computer apache runs under the user www-data, and in documentation or tutorials on file permissions for certain CMS environments, I see reference to Apache working under the user www-data all the time.

MrWhite
  • 42,784
  • 4
  • 49
  • 90
David Csonka
  • 136
  • 2

1 Answers1

1

Webservers run with www-data as user, as what you saw is just the process of the command you typed

James John
  • 149
  • 2
  • How would one check to confirm this? I was using this http://serverfault.com/questions/125865/finding-out-what-user-apache-is-running-as – David Csonka Dec 03 '15 at 23:53
  • 1
    You can use this cat /etc/apache2/envvars | grep APACHE_RUN_USER or grep the user instead ps aux | grep www-data – James John Dec 04 '15 at 00:00
  • Thank you! Do you happen to know off the top of your head the command to use for CentOS? – David Csonka Dec 04 '15 at 00:03
  • 1
    ps aux | grep httpd – James John Dec 04 '15 at 00:13
  • Thank you. Yes, it returns the same value as my user I'm logged in as. I think for the shared host it apparently sets apache to use the same user as the owner of the account. – David Csonka Dec 04 '15 at 04:35
  • 1
    Shared host webservers uses user nobody – James John Dec 04 '15 at 07:09
  • 1
    On a shared host, Apache cannot run as the user nor is this a good idea for security. Apache always installs to use a made-up non-privileged user name typically www-data. I have seen nobody on older installs though it can/may still be used in some cases. It all depends upon the install since the packages will vary depending upon the OS and who created the package. – closetnoc Dec 04 '15 at 14:32