Page 1 of 1

Running HTTPD as different user

PostPosted: 23. July 2011 04:27
by entr0py
My apologies if this is posted somewhere. I read over the site, FAQ and whatnot but did not find an answer...

first i'm running XAMPP 1.7.4. I want to start the apache (httpd) process from the administrator user, but I want it to drop privileges to a local user on the system. I created my user and group 'apacheadmin' on the system and set the directive in httpd.conf as follows:

Code: Select all
# 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.
# It is usually good practice to create a dedicated user and group for
# running httpd, as with most system services.
User apacheadmin
Group apacheadmin   

It starts up fine, but when i look at it in the task manager, it still shows the process running as Administrator. I thought maybe it was a permissions issue, so I made sure that 'apacheadmin' had full control over all files in the xampp directory. Didn't see to help.

What am i missing?

Re: Running HTTPD as different user

PostPosted: 23. July 2011 04:38
by Sharley
This httpd/conf file user/group refers to a Linux permissions setting not a Windows setting as this file is derived from the default server OS Linux and has some references that do not apply for the Windows OS.

Search on the Internet for Windows Security settings for Apache or similar.
You may be able to find something related to what you want to do by right clicking on the apache folder or the httpd.exe file itself then select Properties>Security and then if you wish the Advanced button.

See what comes up in a search knowing that an edit in the httpd.conf file would not usually effect the user/group permissions in a Windows environment.

Re: Running HTTPD as different user

PostPosted: 23. July 2011 04:53
by entr0py
Thanks for the tip! For those whom may be interested, here is how i am running httpd as 'apacheadmin'

install XAMPP as normal. Get everything working. Create the user you wish to have the process run. I wasn't sure what folders/files it would need, so i gave the user full control over C:\xampp\ and below. I will be dialing this back when I figure out only what it needs. I suggest you do as well.

Next, I navigated to:

Code: Select all
Start -> Right click 'My Computer' -> manage -> 'Services and Applications' -> 'Services' (double click) -> Apache2.2 (double click) -> Log on tab

Here i selected "This account" and hit browse. I entered 'apacheadmin' in the box and the password and hit apply.

When I restarted the service, it was running as that user. huzzah!