Web Hosting Talk


Go Back   Web Hosting Talk : Web Hosting Main Forums : Hosting Security and Technology : why User root is running process httpd all time?
Reply

Hosting Security and Technology Configuring and optimizing web hosting servers and operating systems, developing administration scripts, building servers, protecting against hackers, and general security (SSL certificates, etc.)

 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-02-2009, 07:15 PM
papiandy papiandy is offline
View Beta Profile
Newbie
 
Join Date: Apr 2008
Posts: 19
why User root is running process httpd all time?

Hi ... I usually use the "top" command to see what is happening in my server ... Normally everything is OK untill one week ago I start so see this process:

PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1115 root 20 0 10768 10m 164 R 26 0.5 46:17.27 httpd


Is the number 1 on the top list using a lot of CPU and MEM (as I say before ... I never have seen this command in the past)

So when I kill the process everything goes fine but only for a few minutes and then is comming back

any ideas ?
Thks a lot guys !

Reply With Quote
Sponsored Links
  #2  
Old 07-02-2009, 11:51 PM
mugo mugo is offline
View Beta Profile
Intangible Asset Appraiser
 
Join Date: Mar 2009
Location: Austin Tx
Posts: 1,220
This is normal, is used to grab port 80 and fork, among other reasons.
This is what your initial httpd process runs as.
You'll always see 1 owned by root.

__________________
This is the best signature in the world....Tribute!
(It is not the best signature in the world, no. This is just a tribute)


Reply With Quote
  #3  
Old 07-03-2009, 12:02 AM
foobic foobic is offline
View Beta Profile
Community Liaison
 
Join Date: Feb 2005
Location: Australia
Posts: 3,420
It's normal to see one (and only one) httpd process running as root but it's not normal to see it using a lot of resources. Assuming 1115 is still the pid, try
Code:
cat /proc/1115/cmdline

__________________
Chris <ClonePanel>
"Not everything that can be counted counts, and not everything that counts can be counted" - Albert Einstein

Reply With Quote
Sponsored Links
  #4  
Old 07-03-2009, 12:12 AM
mugo mugo is offline
View Beta Profile
Intangible Asset Appraiser
 
Join Date: Mar 2009
Location: Austin Tx
Posts: 1,220
Your CPU is a little high, but .5% Mem isn't a lot.
If your server is busy, this could be normal...how many active connections do you have when the cpu is this high?

__________________
This is the best signature in the world....Tribute!
(It is not the best signature in the world, no. This is just a tribute)


Reply With Quote
  #5  
Old 07-03-2009, 05:58 AM
inspiron inspiron is offline
View Beta Profile
Web Hosting Master
 
Join Date: Jun 2009
Posts: 2,020
Yes, your CPU load seems to be high, You can check active connection by using the
following command,

#netstat -an | grep :80 | sort

This command output will show only the active internet connection to your server
at port 80 and sort the results.

__________________
Support Facility | Your 24/7 outsourcing partner!
Technical support | Server management

|| Technical Articles - BLOG >>

Reply With Quote
  #6  
Old 07-03-2009, 06:06 AM
mugo mugo is offline
View Beta Profile
Intangible Asset Appraiser
 
Join Date: Mar 2009
Location: Austin Tx
Posts: 1,220
For all active, add
|grep ESTAB
onto that

__________________
This is the best signature in the world....Tribute!
(It is not the best signature in the world, no. This is just a tribute)


Reply With Quote
  #7  
Old 07-03-2009, 06:38 AM
whrss2 whrss2 is offline
View Beta Profile
Newbie
 
Join Date: Jul 2009
Location: SLASH ROOT
Posts: 26
Apache(httpd) would run under the user you specify it to. This can be changed under the Apache configuration file "%apacheroot%/conf/httpd.conf"


You could use these commands to know :

1. Which server IP address is getting these connections.

netstat -ntu | awk '{print $4}' | cut -d: -f1 | sort | uniq -c | sort -n|tail -n 5
(ipv4)
netstat -alpn | grep :80 | awk '{print $4}' |awk -F: '{print $(NF-1)}' |sort | uniq -c | sort -n
(ipv6)

2. This would tell you which all IP addresses are currently connected/connecting to your web server.

netstat -alpn | grep :80 | awk '{print $5}' |awk -F: '{print $(NF-1)}' |sort | uniq -c | sort -n

Hope this helps out...

Reply With Quote
  #8  
Old 07-03-2009, 06:42 AM
mugo mugo is offline
View Beta Profile
Intangible Asset Appraiser
 
Join Date: Mar 2009
Location: Austin Tx
Posts: 1,220
That reminds me, I need to get my Sherman tank cleaned...goin' deer hunting tomorrow...

__________________
This is the best signature in the world....Tribute!
(It is not the best signature in the world, no. This is just a tribute)


Reply With Quote
  #9  
Old 07-03-2009, 12:28 PM
papiandy papiandy is offline
View Beta Profile
Newbie
 
Join Date: Apr 2008
Posts: 19
Thks everybody for u help

I got this result with the next commands:
# netstat -an |grep :80 |wc -l
1506

# netstat -an|awk '/tcp/ {print $6}'|sort|uniq -c
13 CLOSE_WAIT
2 CLOSING
273 ESTABLISHED
18 FIN_WAIT1
4 FIN_WAIT2
177 LISTEN
38 SYN_RECV
1558 TIME_WAIT

With the command to see all ips are connectes to my server (netstat -plan|grep :80 | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n) only going to put the last 9 results wich are:

18 0.0.0.0
23 208.53.131.169
24 189.147.148.190
7 115.132.61.130
7 189.163.242.1
7 189.164.59.196
7 66.98.25.235
8 83.35.141.168
10 200.67.219.247
18 0.0.0.0
36 208.53.131.169
66 189.189.134.240


According to my WHM Apache stats I got this:
Current Time: Friday, 03-Jul-2009 11:26:08 CDT
Restart Time: Thursday, 02-Jul-2009 14:31:46 CDT
Parent Server Generation: 0
Server uptime: 20 hours 54 minutes 22 seconds
Total accesses: 1856619 - Total Traffic: 4.3 GB
CPU Usage: u7.16 s6.24 cu154.85 cs0 - .224% CPU load
24.7 requests/sec - 60.1 kB/second - 2493 B/request
14 requests currently being processed, 16 idle workers

_C___..C._WC___CC_CC.CCC_C.._.____WC............._..............
................................................................
................................................................
................................................................


So is it all information good?
Thks

Reply With Quote
  #10  
Old 07-03-2009, 01:16 PM
Winstyn Winstyn is offline
View Beta Profile
WHT Addict
 
Join Date: Sep 2003
Posts: 118
Seems pretty nominal overall. Maybe the CPU usage is due to disk I/O?

__________________
VPSHive / GigeNET Cloud
The fastest cloud control in the world.
█ Visit http://www.gigenetcloud.com/ or Email sales[at]gigenetcloud.com

Reply With Quote
  #11  
Old 07-03-2009, 08:12 PM
ramnet ramnet is offline
View Beta Profile
Virtually Flawless ;)
 
Join Date: Apr 2009
Location: United States
Posts: 2,607
Quote:
Originally Posted by bryan_tong View Post
Seems pretty nominal overall. Maybe the CPU usage is due to disk I/O?
That is very likely since the httpd process is responsible for access and error logging too - and it is not really efficient to have the system do a write on every read - (extfs used to have this issue before noatime and relatime, the httpd issue is similar but not quite as bad).

You might want to consider piping your access logging to another program that will buffer your logs a little so they aren't so disk-intensive.

__________________
RAM Host -- Budget Linux Hosting From The USA
█ Featuring Powerful cPanel LiteSpeed Shared Hosting
█ & Cheap Reliable Virtual Dedicated Servers
YourTrafficTalk - SEO and webmaster discussion forum where you can find ways to promote your site

Reply With Quote
  #12  
Old 07-03-2009, 08:51 PM
papiandy papiandy is offline
View Beta Profile
Newbie
 
Join Date: Apr 2008
Posts: 19
I Think u rigth ...
My error log is about 11Gb and it's getting bigger and bigger every second

MY access log is 26Mb so I think is a lot of difference between error log and access log
The question is what can I do for fix this

Reply With Quote
  #13  
Old 07-03-2009, 09:36 PM
Winstyn Winstyn is offline
View Beta Profile
WHT Addict
 
Join Date: Sep 2003
Posts: 118
Well you can start by truncating the error log to at least 20mbs or less.

11gbs is a lot. The other thing to do would be to check what the error is. It might be something that is continually repeating due to a bad server configuration.

Try doing a tail -f on it and see how often its spiting out errors.

This is most likely the reason for the cpu though if its throwing 100 erros/sec.

__________________
VPSHive / GigeNET Cloud
The fastest cloud control in the world.
█ Visit http://www.gigenetcloud.com/ or Email sales[at]gigenetcloud.com

Reply With Quote
  #14  
Old 07-03-2009, 10:56 PM
ramnet ramnet is offline
View Beta Profile
Virtually Flawless ;)
 
Join Date: Apr 2009
Location: United States
Posts: 2,607
Quote:
Originally Posted by bryan_tong View Post
Well you can start by truncating the error log to at least 20mbs or less.

11gbs is a lot. The other thing to do would be to check what the error is. It might be something that is continually repeating due to a bad server configuration.

Try doing a tail -f on it and see how often its spiting out errors.

This is most likely the reason for the cpu though if its throwing 100 erros/sec.
Agreed. Also check and make sure your site isn't generating lot's of 404 not found errors - things like /favicon.ico are very bad at doing that.

Also, if you haven't got it already, you might consider setting up logrotate to automatically archive your old logs so you don't get massive logs like this (that may be beyond what you are able to do however)

__________________
RAM Host -- Budget Linux Hosting From The USA
█ Featuring Powerful cPanel LiteSpeed Shared Hosting
█ & Cheap Reliable Virtual Dedicated Servers
YourTrafficTalk - SEO and webmaster discussion forum where you can find ways to promote your site

Reply With Quote
  #15  
Old 07-04-2009, 12:40 PM
whrss whrss is offline
View Beta Profile
Web Hosting Guru
 
Join Date: May 2009
Location: SLASH ROOT
Posts: 305
As you know 0-1024 are reserved logical ports. If you need to open a reserved port, you need to be the super user.

That is why you see the first http process running under 'root'. This process will not accept any tcp connections and i responsible only for opening port 80.

__________________
WebHostRepo a.k.a WHR; The ultimate Support Repository
We let our customers define 'QUALITY'
http://www.webhostrepo.com/
Follow us on twitter http://twitter.com/whrss

Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes
Postbit Selector

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump
Login:
Log in with your username and password
Username:
Password:



Forgot Password?
Advertisement:

Similar Threads
Thread Thread Starter Forum Replies Last Post
httpd running under user nobody xeno007 Hosting Security and Technology 7 12-08-2008 05:24 PM
WHM emails.. Suspicious process running under user XXXX.. webuser00 Hosting Security and Technology 2 08-29-2008 09:08 PM
How do i work out the running time of a process? PhilG Hosting Security and Technology 4 10-14-2006 05:52 AM
how to on linux bash from root run process as diffrent user? nand Hosting Security and Technology 2 09-05-2004 11:54 PM
getting the user from the httpd process DuncanMcLord Hosting Security and Technology 5 07-28-2002 11:14 PM