Operating System - HP-UX
1830945 Members
2067 Online
110017 Solutions
New Discussion

Re: Starting up apache with user apache

 
SOLVED
Go to solution
Fabrizio_10
Frequent Advisor

Starting up apache with user apache

Hello,

I wuold like to do an intelligent script for start and stop apache from user apache and not root.

Could someone suggest me something?

Thanks in advance
6 REPLIES 6
Clemens van Everdingen
Honored Contributor

Re: Starting up apache with user apache

Hi,

In your httpd.conf you could specify the user.

See:

# 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 nogroup on these systems!
#

C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
Fabrizio_10
Frequent Advisor

Re: Starting up apache with user apache

Hi Clemens,

you are right, but is not exactlly what I want.
Following your post, the situation will be:

[h3mih153]/home/apache#ps -ef |grep httpd
www 12269 12202 0 09:47:15 ? 0:00 /opt/apache/bin/httpd
www 12206 12202 0 09:40:10 ? 0:00 /opt/apache/bin/httpd
www 12270 12202 0 09:47:16 ? 0:00 /opt/apache/bin/httpd
www 12207 12202 0 09:40:10 ? 0:00 /opt/apache/bin/httpd
www 12203 12202 0 09:40:09 ? 0:00 /opt/apache/bin/httpd
root 12202 1 0 09:40:08 ? 0:00 /opt/apache/bin/httpd
www 12271 12202 0 09:47:16 ? 0:00 /opt/apache/bin/httpd
www 12204 12202 0 09:40:10 ? 0:00 /opt/apache/bin/httpd
www 12205 12202 0 09:40:10 ? 0:00 /opt/apache/bin/httpd


This is correct, but I wuold like to change the owner of the father of pid (actually is root) in apache.

Thanks !
Clemens van Everdingen
Honored Contributor

Re: Starting up apache with user apache

Hi,

Ok I now understand your question fully.

But I don't know if this is possible at all.

See:

# If you wish httpd to run as a different user or group, you "must" run ----> MUST
# httpd as root initially and it will switch.

But then again maybe someone else has done this before.
On my system it's the same as your example.

C.
The computer is a great invention, there are as many mistakes as ever, but they are nobody's fault !
U.SivaKumar_2
Honored Contributor
Solution

Re: Starting up apache with user apache

Hi,

For your requirement to work you will have to change the ownership of httpd execuatble to user apache. And you will have to specify the port in which httpd listens above 1024 , say 8080 and give proper read and execute permissions for apache files for user apache.

Normal user processes cannot bind to the ports lesser than 1024.

So even with "User" option in httpd.conf , apache is designed in such a way that parent httpd has to run as root for binding to ports lesser than 1024 ( port 80 as standard http port).

regards,
U.SivaKumar
Innovations are made when conventions are broken
Fabrizio_10
Frequent Advisor

Re: Starting up apache with user apache

Thanks a lot to all and in particoular to Siva...

It works fine!

Bye
U.SivaKumar_2
Honored Contributor

Re: Starting up apache with user apache

Assigning points encourages us
Innovations are made when conventions are broken