Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I just got my very own Linux (Debian Stable) server, and installed Apache2, PHP5 and MySQL. It's supposed to be used for hosting of my own and others websites.

As it is now, Apache is running as its own user. That means that I need to "chown" all files and folders in a webroot, to the Apache-user, or else Apache can't edit and/or delete them. That is a big problem in Wordpress when installing plugins and such.

I Google'd a little, and found a website which says that you need to run the user's Apache instance as their own user, instead of running Apache as its own user.

How do I do that?

share|improve this question
up vote 3 down vote accepted

For security and compatibility reasons, it is not such a great idea.

A better idea might be to use suexec, which executes each person's cgi's as them.

If you really want to do this


User youruserid
Group yourgroupid

to your /etc/apache2/apache.conf

If you don't know where this goes in the file or think it might be a different file, scan for the strings User and Group. There may be a setting already.

Here's some documentation you might like

User directive

General apache2

share|improve this answer
I will take a closer look at suexec. But what about performance? Is there any performance-loss by using CGI? – Niklas H Feb 13 '10 at 20:15
Do you mean using suexec or using cgi? When using suexec there may be a performance hit, I would imagine not too much. I've never noticed it. If CGI I think this is another question. Some programs use fastcgi, and other techniques, which are faster than regular cgi. – Paul Feb 13 '10 at 20:24
Is it really so difficult to run chown and chmod to the web server's account -- if it is your server? An insecure cgi program will allow vandals to potentially look at or mess with anything owned by the web server's account. – Paul Feb 13 '10 at 20:26
The problem with doing chown, is that I will need to chmod 777 all the files aswell, or else I can't touch them through FTP. And I am not that excited about 777'ing everything. – Niklas H Feb 13 '10 at 20:34
If you are hosting for various users, then you want the suexec so that their scripts also work (if you want them to install scripts) – Paul Feb 13 '10 at 21:13

with apache2 you have the possibility to use the ITK multi-processing-module. This spawns off new processes running under the destination user's uid and gid. I'm using this for great effect on my hosting solution.

There should be packages for all major distributions available.

share|improve this answer
I've used ITK extensively and found it both stable and easy to use. I used it while working for a web hosting company as well. – jemmille Feb 14 '10 at 1:22

I strongly recommend against having Apache run as any real user. If an exploit is found in your sites, a malicious user can read or alter your personal files.

WordPress will run fine with the files being owned by your user account and with Apache running as a different user. There are a few files and paths which you should chgrp to the same group as the Apache server and make group writable. That way Apache can make the necessary changes without the risk of a user having full access to the rest of your files.

You should read the WordPress document on Changing File Permissions.

share|improve this answer

mpm-itk works good, it can be used also for non-php virtualhost.

If you need better scalability and performances, fastcgi pools are a better choice.

If you want to try something new, checkout php-fpm, debian lenny packages available on

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.