Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I give apache permission to use a directory on an NTFS partition?

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?

like image 441
Tom V Avatar asked Dec 20 '22 09:12

Tom V


2 Answers

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
like image 93
Acheu Avatar answered Dec 22 '22 22:12

Acheu


In my experience I've always had to remount the drive with RW permissions. found this:

sudo mount -t ntfs -o rw,auto,user,fmask=0022,dmask=0000 /dev/whatever /mnt/whatever

or:

For NTFS partitions, use the permissions option in fstab.

First unmount the ntfs partition.

Then edit /etc/fstab

Graphical gksu gedit /etc/fstab

Command line sudo -e /etc/fstab

Identify your partition UUID with blkid

sudo blkid

And add or edit a line for the ntfs partition

# change the "UUID" to your partition UUID
UUID=12102C02102CEB83 /media/windows ntfs-3g auto,users,permissions 0 0

Make a mount point (if needed)

sudo mkdir /media/windows

Now mount the partition

mount /media/windows

The options I gave you, auto, will automatically mount the partition when you boot and users allows users to mount and umount .

You can then use chown and chmod on the ntfs partition.

Both found here: https://askubuntu.com/questions/11840/how-to-chmod-on-an-ntfs-or-fat32-partition

like image 36
Webb Avatar answered Dec 22 '22 22:12

Webb