Ask Ubuntu is a question and answer site for Ubuntu users and developers. 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 install apache2 on ubuntu,the default www directory is /var/www/ ,I use ln to link it to '/media/Software/Program Files/wamp/www/' at the windows directory,but the apache shows 'You don't have permission to access / on this server',Then I use 'sudo chmod -R 777 /media/Software/Program\ Files/wamp/www/' to set the permission,but it didn't work,and nothing changed when I saw the permission in the preporties of the '.../wamp/www' folder.So I want to know How can I change the www directory to '.../wamp/www' as I also need to access this diretory in windows.

share|improve this question
up vote 2 down vote accepted

There are two things around.

One is whether Apache is allowed to follow symlinks. Is you link a symlink via ln -s? It is the recommended way but it might be a security issue in some servers and it is disabled many times.

See for more info on that topic but esentially you need AllowOverride None as here:

<Directory />
    Options FollowSymLinks

Other topic is the permissions.

Windows Partition

As it is a Windows directory (it seems so) the best option will be to follow this guide

Essentially it recommends you to edit the /etc/fstab The line should be like this one:

/dev/sdb5 /media/Software ntfs-3g defaults, ..., umask=227 0 0

The interesting part is the umask. I will recommend to put the last digit as 6 or 7 for allowing Apache to access.

The recommended way is to use UUID. The steps are:

0) Make a backup of fstab (just in case ;))

sudo cp /etc/fstab /etc/fstab.bak

1) Get the UUID of your hard-drive:

sudo blkid

2) Add the line in fstab

It should be something like this:

UUID=$you_uuid  /media/Software  ntfs-3g  defaults,user,auto,utf8

I have added auto so that it auto mounts. If you don't want that use noauto instead.

This will give it full permission. If you prefer different permissions use dmask=000,fmask=111 as options. Instead of the it uses different numbers than chmod. If you want you can add also uid=100,gid=100 with the wanted another uid or gid.


Linux/Unix Partition (if not using Windows partitions)

If it is not a Windows partition the permissions should be in the standard linux way.

The best option is to change the permission of that directory. I will do it in this way:

chgrp -R www-data /media/Software/Program Files/wamp/www/

Also you will need read permission (maybe write) for that directory. It is done in this way:

chmod g+r /media/Software/Program Files/wamp/www

For also adding write:

chmod g+rw /media/Software/Program Files/wamp/www

But again that won't work if the partition is a NTFS partition because Windows do not store permission in the disk in this way.

share|improve this answer
Thank you for your answer.for the first topic,I did use ln -s,and thank you for your reminding me about the security issue.I use the symlink just want to try if the permission works。The main problem is the second topic,it's a NTFS partition,so,do you mean that I should edit the /etc/fstab ?I just think the NTFS partiton is hard to deal with in the linux but I need to use that in windows. – Dying Nov 26 '12 at 12:57
Yes, you should edit it in /etc/fstab NTFS does not save information about permissions. You need to say which permissions to use on that partition. I'm updating the answer with some help in this topic. – Davisein Nov 26 '12 at 13:55
Thanks a lot,I have solved that problem by edit the fstab. – Dying Nov 28 '12 at 9:05
Perfect, I am happy to help. If you used my instructions for editing the fstab you could accept my answer so that incoming users don't need to read the comments ;) – Davisein Nov 28 '12 at 10:45
OK,I just didn't know that,I am new here. – Dying Nov 30 '12 at 7:46

Assuming you have a default Apache install, you should update the DocumentRoot directive inside /etc/apache2/sites-enabled/000-default and have this it point to /media/Software/Program\ Files/wamp/www/

DocumentRoot /media/Software/Program\ Files/wamp/www

Further infos can be found here:

share|improve this answer
I think it will turns out the same as I did,I have done that before,the main problem is that the apache has no permission to access the /media/Software/Program\ Files/wamp/www – Dying Nov 25 '12 at 9:31

For me the problem was none of the above but something much simpler.

I had two Apache2 virtual hosts competing for the same domain name in the ServerAlias line.

In one virtual host file, I had


but in the other virtual host file I had a wildcard entry:

ServerAlias *

This caused a conflict in Apache 2. Removing the wildcard entry (with the *) solved the problem for me.

(Taken from (K)Ubuntuguide at .)

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.