LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 11-27-2005, 08:28 PM   #1
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Rep: Reputation: 30
who should httpd run as


Hello,

Just ran top and noticed that I have httpd running as root as well as www.
Code:
last pid:   637;  load averages:  0.00,  0.00,  0.00    up 0+00:22:56  10:24:21
36 processes:  1 running, 35 sleeping
CPU states:  1.2% user,  0.0% nice,  0.0% system,  0.0% interrupt, 98.8% idle
Mem: 78M Active, 11M Inact, 30M Wired, 24M Buf, 123M Free
Swap: 512M Total, 512M Free

  PID USERNAME PRI NICE   SIZE    RES STATE    TIME   WCPU    CPU COMMAND
  495 root     -58    0 50176K 49396K bpf      0:04  0.00%  0.00% snort
  494 mysql     20    0 56632K 26560K kserel   0:03  0.00%  0.00% mysqld
  621 root      96    0  2316K  1584K RUN      0:01  0.00%  0.00% top
  435 root      96    0 15116K  9832K select   0:01  0.00%  0.00% httpd
  614 lord_fu   96    0  6116K  2952K select   0:00  0.00%  0.00% sshd
  170 root       8    0  1780K  1396K nanslp   0:00  0.00%  0.00% ipmon
  276 root      96    0  1328K   896K select   0:00  0.00%  0.00% syslogd
  611 root       4    0  6140K  2892K sbwait   0:00  0.00%  0.00% sshd
  618 root      20    0  2296K  1796K pause    0:00  0.00%  0.00% csh
  617 lord_fu    8    0  1608K  1284K wait     0:00  0.00%  0.00% su
  460 mysql      8    0  1660K  1196K wait     0:00  0.00%  0.00% sh
  615 lord_fu    8    0  1692K  1284K wait     0:00  0.00%  0.00% sh
  413 root       8    0  1364K  1052K nanslp   0:00  0.00%  0.00% cron
  550 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  551 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  556 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  554 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  557 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  552 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  555 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  553 root       5    0  1288K   952K ttyin    0:00  0.00%  0.00% getty
  392 root      96    0  3384K  2544K select   0:00  0.00%  0.00% sshd
  504 root       4    0  1360K   828K accept   0:00  0.00%  0.00% vsftpd
  455 www        4    0 15144K  9860K accept   0:00  0.00%  0.00% httpd
  454 www        4    0 15144K  9860K accept   0:00  0.00%  0.00% httpd
  456 www        4    0 15144K  9860K accept   0:00  0.00%  0.00% httpd
  458 www        4    0 15144K  9860K accept   0:00  0.00%  0.00% httpd
  457 www        4    0 15144K  9860K accept   0:00  0.00%  0.00% httpd
  520 root     116    0  1240K   744K select   0:00  0.00%  0.00% moused
  258 root     116    0   516K   356K select   0:00  0.00%  0.00% devd
  192 root      20    0  1192K   648K pause    0:00  0.00%  0.00% adjkerntz
I have never noticed that before, is that bad? I thought httpd runs a www..
Slightly off topic whom should the files in my www dir be owned by?

Thank you for any help offered.

freeBSD 5.4
default kernel
apache-1.3.34

Last edited by lord-fu; 11-27-2005 at 08:31 PM.
 
Old 11-27-2005, 08:54 PM   #2
btmiller
Senior Member
 
Registered: May 2004
Location: In the DC 'burbs
Distribution: Arch, Scientific Linux, Debian, Ubuntu
Posts: 4,290

Rep: Reputation: 378Reputation: 378Reputation: 378Reputation: 378
Apache must be started as root since only root can bind to port lower than 1024. The individual listeningprocesses run as the nonpriviliged www user though, as you see. As for the ownership of the files in the Web directory, that's mostly your call. I set them to be owned by whoever will need to edit them most frequently . One thing I do though is to not make them writeable by the www user though so they can't be modified by the web server itself (of course the www user must be able to read them).
 
Old 11-27-2005, 09:00 PM   #3
lord-fu
Member
 
Registered: Apr 2005
Location: Ohio
Distribution: Slackware && freeBSD
Posts: 676

Original Poster
Rep: Reputation: 30
Awesome, thank you for clearing that up for me.
 
Old 11-27-2005, 10:14 PM   #4
The MCP
Member
 
Registered: Nov 2003
Distribution: SUSE
Posts: 31

Rep: Reputation: 15
Starting apache w/o root priveleges

Quote:
Originally posted by btmiller
Apache must be started as root since only root can bind to port lower than 1024. The individual listeningprocesses run as the nonpriviliged www user though, as you see. As for the ownership of the files in the Web directory, that's mostly your call. I set them to be owned by whoever will need to edit them most frequently . One thing I do though is to not make them writeable by the www user though so they can't be modified by the web server itself (of course the www user must be able to read them).
A little trick I came up with to avoid having to be root to start httpd: Have httpd listen on some high port (like 6666), then setup firewall rules to redirect all incoming traffic on 80 to 6666 and all outbound traffic on 6666 to 80. The fewer root processes you have running the better, right?

BTW - Good idea to take away apache's write access to the DocumentRoot! I'll go implement that now...
 
  


Reply



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



Similar Threads
Thread Thread Starter Forum Replies Last Post
Starting httpd: /usr/sbin/httpd: symbol lookup error: /usr/local/lib/libaprutil-0.so. bijuhpd Linux - Newbie 1 10-30-2005 05:07 PM
configuration of httpd.conf to run apache server adityabhat2 Linux - Newbie 2 02-13-2005 12:10 PM
service httpd status, results in httpd dead but subsys locked squadja Red Hat 2 09-11-2004 10:31 PM
httpd: Unclean shutdown of previous Apache run mfitzpat Linux - Software 1 04-14-2004 02:08 PM
httpd chokes on ScriptAlias line in Apache httpd.conf lhoff Linux - Software 1 07-14-2003 10:32 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 08:20 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration