Results 1 to 6 of 6

Thread: HTTP server (apache2) running as root

  1. #1
    Join Date
    Apr 2010
    Location
    Boston, MA, USA
    Beans
    14

    HTTP server (apache2) running as root

    Hi all,

    I've got Ubuntu 10 running here and have just discovered that the processes for the HTTP server (apache2) appear to run as user root as opposed to user apache/www/whatever as is custom on most other Linux/Unix distros. Why would that be? Seems very insecure to me.

    Boris.

  2. #2
    Join Date
    Oct 2006
    Beans
    4,628
    Distro
    Kubuntu 18.10 Cosmic Cuttlefish

    Re: HTTP server (apache2) running as root

    Apache on Ubuntu runs as www-data. Did you change something?
    Blog | Ubuntu User #15350 | Zsh FTW | Ubuntu Security | Nothing to hide?
    AMD Phenom II X6 1075T @ 3GHz, Nvidia GTX 650, 8GB DDR3 RAM, 1 X 1TB, 2 X 3TB HDD
    Please don't request support via PM


  3. #3
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HTTP server (apache2) running as root

    Quote Originally Posted by borepstein View Post
    Hi all,

    I've got Ubuntu 10 running here and have just discovered that the processes for the HTTP server (apache2) appear to run as user root as opposed to user apache/www/whatever as is custom on most other Linux/Unix distros. Why would that be? Seems very insecure to me.

    Boris.
    Can you post the output you are looking at please so we can see what you are asking about.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  4. #4
    Join Date
    Aug 2011
    Beans
    6

    Re: HTTP server (apache2) running as root

    Quote Originally Posted by bodhi.zazen View Post
    Can you post the output you are looking at please so we can see what you are asking about.
    I am hosting webserivces on apache2 in ubuntu10. I want to start the apache2 as root and then the service should run as the user www-data. The processes running are reproduced below -

    USER PID CPU MEM VSZ RSS TTY STAT START TIME COMMAND
    root 2824 0.0 0.1 8104 3752 ? Ss 08:37 0:00 /usr/sbin/apache2 -k start
    www-data 2824 0.0 0.1 8104 3752 ? Ss 08:37 0:00 /usr/sbin/apache2 -k start
    www-data 2824 0.0 0.1 8104 3752 ? Ss 08:37 0:00 /usr/sbin/apache2 -k start
    www-data 2824 0.0 0.1 8104 3752 ? Ss 08:37 0:00 /usr/sbin/apache2 -k start

    Continuing to run apache2 as root might not be secure thus i want that once the apache2 starts as root it should then move down to continue runing as the user www-data and it stop for user root.

  5. #5
    Join Date
    Apr 2006
    Location
    Montana
    Beans
    Hidden!
    Distro
    Kubuntu Development Release

    Re: HTTP server (apache2) running as root

    Take a look at how apache works

    The parent server runs as root and spawns child processes which run as www-data

    The child processes are the ones listening for connections and doing the work, not the parent server.

    While the parent process is usually started as root under Unix in order to bind to port 80, the child processes and threads are launched by Apache as a less-privileged user.
    See:

    http://httpd.apache.org/docs/2.2/mod/prefork.html

    http://httpd.apache.org/docs/2.2/mod/worker.html
    Last edited by bodhi.zazen; August 4th, 2011 at 04:53 AM.
    There are two mistakes one can make along the road to truth...not going all the way, and not starting.
    --Prince Gautama Siddharta

    #ubuntuforums web interface

  6. #6
    Join Date
    Jan 2005
    Location
    Sydney (currently)
    Beans
    21
    Distro
    Ubuntu Breezy 5.10

    Re: HTTP server (apache2) running as root

    That root process is the parent Apache process.

    It is required to be root so that Apache can bind to port 80 (a privileged port).

    The parent process does not serve any requests, so is not inherently insecure.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •