Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
apache running as root
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Networking & Security
View previous topic :: View next topic  
Author Message
Squinky86
Retired Dev
Retired Dev


Joined: 25 Mar 2003
Posts: 309
Location: Alabama, USA

PostPosted: Wed Feb 27, 2008 7:48 pm    Post subject: apache running as root Reply with quote

I have apache running (for the most part, default configuration, version 2.2.8-r1), but there are a couple aspects I don't understand. (note: using worker MPM and +threads).

First, when I look at the running processes on my system, I have 4 apache2 processes:
Code:
# ps -A | grep apache2
23537 ?        00:00:00 apache2
23538 ?        00:00:00 apache2
23541 ?        00:00:00 apache2
23543 ?        00:00:00 apache2
But when I look at the users of each process, I see the following:
Code:
#top -p `ps -A | awk 'BEGIN { ORS = ","} /apache2/ { print $1 }'`0
(top shows the following):
23537 root      18   0  324m  12m 5940 S    0  0.6   0:00.05 apache2
23538 apache    22   0  223m 3984  692 S    0  0.2   0:00.00 apache2
23541 apache    18   0  738m  21m 9200 S    0  1.1   0:00.16 apache2
23543 apache    18   0  535m  12m 3352 S    0  0.6   0:00.00 apache2
24015 root      15   0 16996 1172  912 R    0  0.1   0:00.00 top
Why is the first process, pid #23537, running as root? Furthermore, looking at phpinfo(); on my server, the following looks very peculiar:
Code:
(under environment): USER = root
and under variables, _ENV["USER"] = root
Why are these variables not showing up as "apache"?

EDIT 1: remove useless grep (and move to awk statement) so that people don't flame me.
EDIT 2: remove useless tr (and move to awk statement) so that people don't flame me.
_________________
Me
Back to top
View user's profile Send private message
vad3r
Guru
Guru


Joined: 02 May 2004
Posts: 461
Location: Munich, Germany

PostPosted: Wed Feb 27, 2008 9:22 pm    Post subject: Reply with quote

I'm not sure about the PHPInfo output but ps is right. The first process always run's as root. All childs give away their privileges and run as apache.
_________________
-- http://www.linuxaddicted.de/ | Please help to answer open questions
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Networking & Security All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum