Linux – How to give apache permission to use a directory on an NTFS partition

apachefile-permissionslinuxntfsUbuntu

I am running Linux (Lubutu 12.10) on an older machine with a 20GB hard drive. I have a 1 TB external hard drive with an NTFS partition on it. On that partition, there is www directory that holds my web content. It is auto-mounted at startup as /media/t515/NTFS.

I would like to change the apache document directory from /var/www to /media/t515/NTFS/www.

I need to keep the partition as an NTFS partition, because I use the same hard drive on a different machine running WAMP.

I changed the file "default" in /etc/apache2/sites-available to the new location, and restarted the server. When I tried to go to local host, I got the error:

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

I then changed the automount options in fstab to include the option "umask=0000", and then to "umask=2200", both to no avail. I still get the same error message.

I can access the NTFS partition with no problem from other applications, and when logged in as any user. But Apache seems to be unable (or unwilling) to access the partition. How do I give apache permission to use a directory on an NTFS partition?

Best Answer

After many many attempts here is what succeeded for me and nothing else that is : changing the configuration of Apache so that it uses www-data (Apache user) no more but my own user instead.

Very simple to do. In my version of Apache the two lines to be changed are in the /etc/apache2/envvars file (it can be another file in another version) :

export APACHE_RUN_USER=www-data
export APACHE_RUN_GROUP=www-data

I replaced www-data by my user name (here toto :)) :

export APACHE_RUN_USER=toto
export APACHE_RUN_GROUP=toto