I wan to use my Dropbox/Web directory as the server directory for LAMP. I cahnged /etc/apache2/sites-available/default

DocumentRoot /home/me/Dropbox/Web #changed from /etc/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
<Directory /home/me/Dropbox/Web/> #changed from /etc/www
    Options Indexes FollowSymLinks MultiViews
    AllowOverride None
    Order allow,deny
    allow from all

And now I get


You don't have permission to access / on this server.

Apache/2.2.22 (Ubuntu) Server at localhost Port 80

www-data, the group/user Apache runs is not allowed to read in your home directory.

You can use regular permissions to change that as gertvdijk explained in its answer.

I would consider using acl instead of regular permissions, allowing to add permission to apache instead of replacing the group in home directory or making the directory world readable.

For that, you need to install acl:

sudo apt-get install acl

You can use man setfacl to have more info.

To add permissions to apache:

sudo setfacl -m d:g:www-data:X,g:www-data:X /home/me
sudo setfacl -m d:g:www-data:X,g:www-data:X /home/me/Dropbox
sudo setfacl -Rm d:g:www-data:rX,g:www-data:rX /home/me/Dropbox/Web

1st and 2nd commands will allow Apache (www-data) to change directory only through the path (without allowing other subdirectories) in your home. They are probably not needed if you are using default config but if you already changed permissions (or will change in the future) to disalow other users to read in your home, they are needed.

The 3rd one is the command that will allow Apache to read and change directories in Dropbox/web and sub-directories).

Obs: uppercase X will act only on directories instead of lowercase x that would act on both files and directories (this way apache user is only able to change directories, not executing files).

  • thanx, works great – ilyo Dec 23 '12 at 16:30

Apache probably can't read from your Dropbox directory. In Ubuntu, Apache is configured to run as user www-data. Make sure you set the permissions on your filesystem to allow Apache reading the whole path.

To test whether this is really your issue, try in a terminal

sudo su -l www-data -s /bin/bash

and then cd step by step to your Dropbox folder:

cd /home
cd me
cd Dropbox
cd Web

Fix the permissions, e.g.

  • chmod o+rx on directories and chmod o+r on files, or
  • change groups on files/directories chgrp www-data and allow only the www-data group to read/access: chmod g+r for files and chmod g+rx for directories.
  • 1
    using chmod g+rX will do +rx on directories and +r on regular files. That's a lot easier ;) – laurent Dec 23 '12 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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