All files on automounted NTFS partition are marked as executable
Solution 1:
The noexec
option has nothing to do with the actual permissions; it's just for not allowing to run anything from that partition:
~ $ ls -l test.sh
-rwxr-xr-x 1 jw jw 28 Aug 30 13:05 test.sh
~ $ ./test.sh
Hello world
~ $ sudo mount -o remount,noexec /home
~ $ ./test.sh
bash: ./test.sh: Permission denied
~ $ ls -l test.sh
-rwxr-xr-x 1 jw jw 28 Aug 30 13:05 test.sh
As you see, once the partition is mounted with the noexec
option, test.sh cannot be run; but the permissions themselves did not change.
NTFS does not support the executable bit. The way that an NTFS is seen by the system and what how permissions are set depends therefore only on how it was mounted. Normally, this is done with the umask
mount option. This explains also why you cannot change the permissions: there is no way to store them, because NTFS does not support them.
Unfortunately, if you mount everything with the 'non-executable' bit, you will not be able to change into directories, because they must be executable in order to be entered. You can use the options dmask
and fmask
for setting default permissions separately to for directories and files on a mounted NTFS system.
Solution 2:
With January's help I was able to find the following fstab options that solved my problem:
umask=0000,fmask=0111
The fstab entry for my NTFS partition is now as follows:
#Windows-Partition
UUID=368CEBC57807FDCD /media/Share ntfs defaults,uid=1000,gid=1000,umask=0000,fmask=0111 0 0
Source: http://www.linuxquestions.org/questions/slackware-14/mount-ntfs-so-that-files-are-not-executable-buts-directories-are-363315/
Edit: Changing these options also means that you will not be able to set anything to executable on your NTFS drive. In my case that's not a problem as I don't plan on storing any executables on this partition.