Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Apache: Users

How in the name of LINUX do u set apache2.2 to run as user www-data

 

 

Apache users RSS feed   Index | Next | Previous | View Threaded


demetri007 at optonline

Jul 24, 2007, 11:25 PM

Post #1 of 11 (524 views)
Permalink
How in the name of LINUX do u set apache2.2 to run as user www-data

I have googled for information in configuring apache to run as www-data
user a couple of days and all i find are tid bits and they are very general.
I tried changing permissions for the directories, the www-data user and
group were added by the installation of xubuntu

I have search high and low and cant find a HOW-TO anywhere. Please help

Thank you,
Demetri

running:
Xubuntu 7.04
Apache 2.2
PHP 5.2.1
mySql 5.0.38



---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


dim at colebatch

Jul 25, 2007, 3:14 AM

Post #2 of 11 (499 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Hi Demetri,

Change the User parameter in httpd.conf. Here's what I have in mine:

# If you wish httpd to run as a different user or group, you must run
# httpd as root initially and it will switch.
#
# User/Group: The name (or #number) of the user/group to run httpd as.
# . On SCO (ODT 3) use "User nouser" and "Group nogroup".
# . On HPUX you may not be able to use shared memory as nobody, and the
# suggested workaround is to create a user www and use that user.
# NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
# when the value of (unsigned)Group is above 60000;
# don't use Group #-1 on these systems!
#
User apache
Group apache

Hope that helps.

cheers,
dim


On 7/25/07, Demetri T. <demetri007 [at] optonline> wrote:
> I have googled for information in configuring apache to run as www-data
> user a couple of days and all i find are tid bits and they are very general.
> I tried changing permissions for the directories, the www-data user and
> group were added by the installation of xubuntu
>
> I have search high and low and cant find a HOW-TO anywhere. Please help
>
> Thank you,
> Demetri
>
> running:
> Xubuntu 7.04
> Apache 2.2
> PHP 5.2.1
> mySql 5.0.38
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


demetri007 at optonline

Jul 25, 2007, 7:56 AM

Post #3 of 11 (498 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Dmitri Colebatch wrote:
> Hi Demetri,
>
> Change the User parameter in httpd.conf. Here's what I have in mine:
>
> # If you wish httpd to run as a different user or group, you must run
> # httpd as root initially and it will switch.
> #
> # User/Group: The name (or #number) of the user/group to run httpd as.
> # . On SCO (ODT 3) use "User nouser" and "Group nogroup".
> # . On HPUX you may not be able to use shared memory as nobody, and the
> # suggested workaround is to create a user www and use that user.
> # NOTE that some kernels refuse to setgid(Group) or semctl(IPC_SET)
> # when the value of (unsigned)Group is above 60000;
> # don't use Group #-1 on these systems!
> #
> User apache
> Group apache
>
> Hope that helps.
>
> cheers,
> dim
>
>
> On 7/25/07, Demetri T. <demetri007 [at] optonline> wrote:
>> I have googled for information in configuring apache to run as www-data
>> user a couple of days and all i find are tid bits and they are very
>> general.
>> I tried changing permissions for the directories, the www-data user and
>> group were added by the installation of xubuntu
>>
>> I have search high and low and cant find a HOW-TO anywhere. Please help
>>
>> Thank you,
>> Demetri
>>
>> running:
>> Xubuntu 7.04
>> Apache 2.2
>> PHP 5.2.1
>> mySql 5.0.38
>>
>>
>>
>> ---------------------------------------------------------------------
>> The official User-To-User support forum of the Apache HTTP Server
>> Project.
>> See <URL:http://httpd.apache.org/userslist.html> for more info.
>> To unsubscribe, e-mail: users-unsubscribe [at] httpd
>> " from the digest: users-digest-unsubscribe [at] httpd
>> For additional commands, e-mail: users-help [at] httpd
>>
>>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>
Thanks for the reply Dim

thats already set by default when i installed apache(which is
www-data). I think i am having an issue either with file/directory
permissions and/or on how Apache is starting up; it just stays running
as root instead switching over to www-data (the user/group set when
installed).

I am having a hard time finding the requirements for apache to run as
another user, would you or anyone know. i have checked the apache docs
to no avail, and still searching the net.

Thanks
Demetri

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


joshua at slive

Jul 25, 2007, 8:03 AM

Post #4 of 11 (503 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

On 7/25/07, Demetri T. <demetri007 [at] optonline> wrote:

> thats already set by default when i installed apache(which is
> www-data). I think i am having an issue either with file/directory
> permissions and/or on how Apache is starting up; it just stays running
> as root instead switching over to www-data (the user/group set when
> installed).
>
> I am having a hard time finding the requirements for apache to run as
> another user, would you or anyone know. i have checked the apache docs
> to no avail, and still searching the net.

You are probably misinterpreting something, since apache will not run
as root without compile-time changes.

There is supposed to be one (control) process running as root that
launches child processes running under the specified User/Group that
actually handle requests.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


dragon at crimson-dragon

Jul 25, 2007, 8:12 AM

Post #5 of 11 (499 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Demetri T. wrote:

>thats already set by default when i installed apache(which is
>www-data). I think i am having an issue either with file/directory
>permissions and/or on how Apache is starting up; it just stays
>running as root instead switching over to www-data (the user/group
>set when installed).
>
>I am having a hard time finding the requirements for apache to run
>as another user, would you or anyone know. i have checked the apache
>docs to no avail, and still searching the net.
---------------- End original message. ---------------------

I am sure somebody will correct me if I am wrong but IIRC, invoking
httpd directly results in it continuing to run as the user that invoked it.

As stated in the manpage for httpd:

httpd is the Apache HyperText Transfer Protocol (HTTP) server
program. It is designed to be run as a standalone
daemon process. When used like this it will create a pool of
child processes or threads to handle requests.

In general, httpd should not be invoked directly, but rather
should be invoked via apachectl on Unix-based sys-
tems or as a service on Windows NT, 2000 and XP and as a
console application on Windows 9x and ME.



How are you starting Apache?

Are you using the startup script apachectl or are you starting it directly?


Most *nix type OS distributions also have a startup script that is
run at system boot to invoke httpd which generally does some house
keeping stuff and then invokes apachectl. You may have to use a
utility like checkcfg on Red Hat systems or your system's equivalent
to enable the startup on boot.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


joshua at slive

Jul 25, 2007, 8:35 AM

Post #6 of 11 (498 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

On 7/25/07, Dragon <dragon [at] crimson-dragon> wrote:

>
> I am sure somebody will correct me if I am wrong but IIRC, invoking
> httpd directly results in it continuing to run as the user that invoked it.

Consider yourself corrected ;-)

httpd always switches users for child processes when started as root.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


dragon at crimson-dragon

Jul 25, 2007, 9:04 AM

Post #7 of 11 (498 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Joshua Slive wrote:
>On 7/25/07, Dragon <dragon [at] crimson-dragon> wrote:
>
>>
>>I am sure somebody will correct me if I am wrong but IIRC, invoking
>>httpd directly results in it continuing to run as the user that invoked it.
>
>Consider yourself corrected ;-)
>
>httpd always switches users for child processes when started as root.
---------------- End original message. ---------------------

Hey, we learn something new every day. :-)

Thanks for the clarification.

Dragon

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Venimus, Saltavimus, Bibimus (et naribus canium capti sumus)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


demetri007 at optonline

Jul 25, 2007, 10:28 AM

Post #8 of 11 (498 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Joshua Slive wrote:
> On 7/25/07, Demetri T. <demetri007 [at] optonline> wrote:
>
>> thats already set by default when i installed apache(which is
>> www-data). I think i am having an issue either with file/directory
>> permissions and/or on how Apache is starting up; it just stays running
>> as root instead switching over to www-data (the user/group set when
>> installed).
>>
>> I am having a hard time finding the requirements for apache to run as
>> another user, would you or anyone know. i have checked the apache docs
>> to no avail, and still searching the net.
>
> You are probably misinterpreting something, since apache will not run
> as root without compile-time changes.
>
> There is supposed to be one (control) process running as root that
> launches child processes running under the specified User/Group that
> actually handle requests.
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>
Ok so looking at my proc list i see 6 apache process(only one with PID
1) and all of them running as root. Does that mean i need to compile
apache with specific options?
I looked over my apache setup this is what i have:

apache is executed using the apache2 script in /etc/init.d
the apache2 script then calls on apachectl in the /usr/bin directory
apachectl then executes apache2 which is in the same directory

I also went over my apache2.conf file and the user/group directives are
listed as:
user www-data
group www-data

I am still trying to find the permissions apache needs for the server
root, document root, and log directory. any idea on this?

Also if you know any good books that you can recommend i am all ears?

Thanks for your help and time
Demetri

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


demetri007 at optonline

Jul 25, 2007, 11:37 PM

Post #9 of 11 (497 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Demetri T. wrote:
> I have googled for information in configuring apache to run as
> www-data user a couple of days and all i find are tid bits and they
> are very general.
> I tried changing permissions for the directories, the www-data user
> and group were added by the installation of xubuntu
>
> I have search high and low and cant find a HOW-TO anywhere. Please help
>
> Thank you,
> Demetri
>
> running:
> Xubuntu 7.04
> Apache 2.2
> PHP 5.2.1
> mySql 5.0.38
>
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server
> Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe [at] httpd
> " from the digest: users-digest-unsubscribe [at] httpd
> For additional commands, e-mail: users-help [at] httpd
>
>
OK does anyone here know why when i run ps aux in a terminal i can see 4
www-data and 1 as root for apache, but when i use xfce taskmanager i see
the root user running all apache process?
all this time i was thinking there was some config error.

Thanks
Demetri

running:
Xubuntu 7.04
Apache 2.2
PHP 5.2.1
mySql 5.0.38

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


uhlar at fantomas

Aug 30, 2007, 8:20 AM

Post #10 of 11 (410 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

On 26.07.07 02:37, Demetri T. wrote:
> OK does anyone here know why when i run ps aux in a terminal i can see 4
> www-data and 1 as root for apache, but when i use xfce taskmanager i see
> the root user running all apache process?
> all this time i was thinking there was some config error.

probably XFCE taskmanager config error :-)

--
Matus UHLAR - fantomas, uhlar [at] fantomas ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
Micro$oft random number generator: 0, 0, 0, 4.33e+67, 0, 0, 0...

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd


jacqui.caren at ntlworld

Aug 30, 2007, 9:53 AM

Post #11 of 11 (410 views)
Permalink
Re: How in the name of LINUX do u set apache2.2 to run as user www-data [In reply to]

Matus UHLAR - fantomas wrote:
> On 26.07.07 02:37, Demetri T. wrote:
>
>>OK does anyone here know why when i run ps aux in a terminal i can see 4
>>www-data and 1 as root for apache, but when i use xfce taskmanager i see
>>the root user running all apache process?
>>all this time i was thinking there was some config error.
>
>
> probably XFCE taskmanager config error :-)

uid/euid?

Jacqui

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe [at] httpd
" from the digest: users-digest-unsubscribe [at] httpd
For additional commands, e-mail: users-help [at] httpd

Apache users RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.