Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

i have been struggling for a couple of days about this problem. I am trying to change the default www directory for Apache/2.4.6 (Ubuntu) web-server under LinuxMint16 and making it point to a NTFS hard disk that i share with another Windows installation. This hard disk is mounted under /media/crash/Yari and no matter what i try, nothing works..while if i change the default www directory to something else in the same hard disk where linux is installed, everything works as expected.

Following are all the changes i have made in order to try to get things working:

The folder where i want my new www is /media/crash/Yari/www I have thus edited the /etc/apache2/apache2.conf file:

DocumentRoot /media/crash/Yari/www
<Directory />
    Options FollowSymLinks
    AllowOverride None
<Directory /media/crash/Yari/www>
    #Options FollowSymLinks
    Options Indexes FollowSymLinks Includes ExecCGI MultiViews
    AllowOverride All
    Order allow,deny
    Allow from all
    Require all granted

Afterwards, as i have seen from this post i have determined my hard disk UUID by typing

sudo blkid

and edited the file /etc/fstab adding this line UUID=#my-hd-uuid# /media/crash/Yari ntfs-3g auto,users,permissions 0 0

To be sure that the apache user (in my case: www-data) had the permissions to access the files inside the new www directory i have changed the group and the owner of all the files inside the hard disk with

sudo chgrp -R www-data /media/crash/Yari
sudo chown -R www-data /media/crash/Yari
sudo chmod -R 775 /media/crash/Yari

I have checked the permissions of the new www directory and the files contained in it by doing

sudo ls -l /media/crash/Yari

and all the files and dir appear as drwxrwxr-x 1 www-data www-data so the previous permissions modifications where done correctly.

Unfortunately i am surely missing something as all the above have been useless! Hope someone can help, thank you very much for any assistance.

share|improve this question
What are the permissions of /media and /media/crash? – Jenny D Jan 9 '14 at 11:29
The permissions of /media/crash are drwxrwxr-x 1 www-data www-data instead the one of /media are drwxr-x---+ 3 root root. Do you think i should change the permissions of /media? – Yari Jan 9 '14 at 14:13

2 Answers 2

In order for apache to access a directory, it must have access rights not only to that directory but to all directories above it. So you need to allow www-data read access to /media and /media/crash as well as /media/crash/Yari.

In general, I would recommend that the apache user not have write access to the directory where the web pages live. It should be enough to allow writing to the directories used for logs, run/pid files and any cache files. Of course if you have e.g. a cgi application that writes to disk, you must allow it to do so, but it would be more secure to keep any such files in a separate directory.

In any case, to solve the immediate problem, either change group ownership of /media and /media/crash to www-data, or change their permissions to 755.

share|improve this answer
Thanks Jenny for you quick and detailed answer. Inspired by you i have used another method that has apparently solved the problem, i will post it here in some hours because right now my account has some limitations. – Yari Jan 9 '14 at 14:49

I was a bit afraid to change the permissions of /media because i have 2 other hard disks under that directory that i have to use under windows and the last permission change on /media/crash/Yari made that hard disk unwritable under windows.

So what i did was to edit the file /etc/fstab by changing the line

UUID=#my-hd-uuid# /media/crash/Yari ntfs-3g auto,users,permissions 0 0


UUID=#my-hd-uuid# /sharedhd ntfs-3g auto,users,permissions 0 0

the new default-www would then have been /sharedhd/www and i had not to change the permissions of /media and /media/crash.

Finally i want to point out that changing the ownership of some folders using

sudo chgrp -R www-data /media/crash/Yari
sudo chown -R www-data /media/crash/Yari

was, in my case, a mistake because it corrupted the ownerships in windows too making all the files and folders inaccessible. The only thing that i had to do was to change the /etc/fstab file and to change the permissions with

sudo chmod -R 777 /sharedhd

Unfortunately by giving 775 permissions i was unable to edit those same files and dirs under windows so i was forced to use 777...If this method has some drawbacks i should be aware of, or if there is some better way of doing it without giving root access to all files please let me know!

share|improve this answer
About permissions: The danger is that if your webserver is compromised, e.g. by an attacker abusing a cgi script that you run there or some other security issue, they can overwrite all the files that are writable by the webserver. How dangerous this may be will depend on your environment. The standard advice is to restrict write access to only those few directories necessary for the server to function. – Jenny D Jan 10 '14 at 13:57

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.