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

Hi I've installed suexec using on ubuntu 12.04:

apt-get install apache2 apache2-suexec libapache2-mod-fcgid php5-cgi

However when I run the following command:

sudo /usr/lib/apache2/suexec -V

I get the following info:

 -D AP_DOC_ROOT="/var/www"
 -D AP_GID_MIN=100
 -D AP_HTTPD_USER="www-data"
 -D AP_LOG_EXEC="/var/log/apache2/suexec.log"
 -D AP_SAFE_PATH="/usr/local/bin:/usr/bin:/bin"
 -D AP_UID_MIN=100
 -D AP_USERDIR_SUFFIX="public_html"

I'm utilizing "/home/user/public_html" to serve users content on the web not "/var/www" How can I change the root directory to "/home"?

share|improve this question
up vote 5 down vote accepted

You're using ubuntu. Therefore recompile is pretty simple.

Add source repository to your /etc/apt/sources.list . For 12.04 run

echo "deb-src precise main"|sudo tee -a /etc/apt/sources.list

change to whatever country you're in. After that update your repository.

apt-get update

Change dir and download sources:

mkdir ~/apache_new  ; cd ~/apache_new
apt-get source apache2
apt-get build-dep apache2

It will download and extract apache source and install all dependencies therefore you'll be able to build apache. But you'll need to fix AP_DOC_ROOT. So cd to dir with apache source and change dir path in --with-suexec-docroot option in debian/rules file. So now you'll need to build package. You can make it with

debuild -us -uc

That's it. Now yyou have apache deb-package with fixed path. Just install it with sudo dpkg -i. But watch on updates. Update will wipe out all your efforts. So run aptitude hold apache2 to forbid updates and don't forget to recompile it each time manually (or write script fpr that).

Good luck.

share|improve this answer

Or you can

apt-get install apache2-suexec-custom

after install go to

cd /etc/apache2/suexec

edit the file vi www-data

You can see the first 2 lines, make the changes: replace /var/www with /home


after, restart apache

/etc/init.d/apache2 restart
share|improve this answer
Thanks man, that saved me lot of time. – Vinzius Apr 14 '13 at 20:27
Make sure to also remove apache2-suexec and apache2-suexec-pristine or this won't work. – Mike Jun 22 '14 at 0:00

You need to recompile it from suexec.c, ideally you could install virtualmin, so it will do it automatically via and also it will create accounts, domains etc.

share|improve this answer

I'm utilizing "/home/user/public_html" to serve users content on the web not "/var/www" How can I change the root directory to "/home"?

actually you can use mod_userdir

in this case suexec will spawn scripts from owner of /home/user - in this example "user"

so you don't need to define SuexecUserGroup in apache config

UPD: just enable userdir module

and add to main vhost config

UserDir /home/*/public_html


<Directory /home/*/public_html/ >
      AllowOverride All
      Options +ExecCGI
      AddHandler cgi-script .cgi .pl  .py .rb
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.