I can't get users other than me or root to access the files on a mounted NTFS partition. The answers I've found to similar questions usually mention to set the uid and gid options. In my situation I mount the partition with ntfs-3g and have a UserMapping file defined in the default location. As mentioned in the manual this causes the uid and gid settings to be ignored.

Everything works fine when I access the partition normally. I'm able to change permissions, ownership and execute files, so that's great. However, it would be nice if apache (running as www-data) can also access the files on the partition, which it can't right now.

The line in fstab looks like this:

<UUID> <mount point> ntfs-3g x-gvfs-show,x-gvfs-name=Data,exec,hide_hid_files,hide_dot_files 0 0

To test the access for the apache user I've simply tried:

sudo -u www-data ls -all <absolute path to mount point>

Which returns:

ls: cannot access Data: Permission denied

I also tried to change the group on the mount point to the same group the www-data user is in (which is www-data), without effect.

Is there anything I overlook or can try? Any help would be greatly appreciated!


Output of ntfs-3g.secaudit Data/Server/index.html

secaudit 1.4.0 : NTFS security data auditing
File Data/Server/index.html
Windows attrib : 0x20
Interpreted Unix owner 1000, group 33, mode 0666
No errors were found

Output of ntfs-3g.secaudit Data/Server/

secaudit 1.4.0 : NTFS security data auditing
Directory Data/Server/
Windows attrib : 0x30
Interpreted Unix owner 1000, group 33, mode 0750
Posix descriptor :
    acccnt 3
    defcnt 3
    firstdef 3
    mode : 0750
    tagsset : 0x25
Posix ACL :
    version 2
    flags 0x00
ace 0 : access  USR-O   -1 perms 0007 rwx
ace 1 : access  GRP-O   -1 perms 0005 r-x
ace 2 : access  OTHER   -1 perms 0000 ---
ace 3 : default USR-O   -1 perms 0007 rwx
ace 4 : default GRP-O   -1 perms 0007 rwx
ace 5 : default OTHER   -1 perms 0007 rwx
No errors were found
  • Using ln to test for file access is rather strange to me. Why not use sudo -u www-data cat somefile or even ls or touch – solsTiCe May 29 '15 at 17:15
  • Sorry, that should've been ls instead of ln! Changed it immediately. The Permission denied error remains however, also when I try cat or touch. – KevinBrr May 29 '15 at 17:51
  • what is the output of ntfs-3g.secaudit yourfileonntfspartition ? – solsTiCe May 29 '15 at 17:57
  • I added the output to the question – KevinBrr May 29 '15 at 18:16

I found my answer here, here and here.

Whant went wrong is that I added my mount point to the /media instead of the /mnt directory (as explained in the first and second link). So the permission issue is fixed with:

<UUID> /mnt/Data ntfs-3g x-gvfs-show,x-gvfs-name=Data,exec,hide_hid_files,hide_dot_files 0 0

instead of:

<UUID> /media/kevin/Data ntfs-3g x-gvfs-show,x-gvfs-name=Data,exec,hide_hid_files,hide_dot_files 0 0

That effectively answers my question.

To be sure that apache would really load the page instead of returning a 403 forbidden response, only one thing remained to be done. The apache configuration needed to have the following Directory settings (as explained in the third link). I added this to /etc/apache2/apache2.conf.

<Directory "/mnt/Data/www">
   allow from all
   Options +Indexes
   Require all granted

That's it! Apache can now serve my site from the ntfs partition.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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