I have set up an NTFS partition to automount via fstab:
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc nodev,noexec,nosuid 0 0
# / was on /dev/sda7 during installation
UUID=e63fa8a2-432f-4749-b9db-dab328807d04 / ext4 errors=remount-ro 0 1
# /boot was on /dev/sda4 during installation
UUID=e9ad1bb4-7c1f-4ea9-a6a5-799dfad71c0a /boot ext4 defaults 0 2
# /home was on /dev/sda8 during installation
UUID=eda8c755-5448-4de8-b58c-9cb75823c22d /home ext4 defaults 0 2
# swap was on /dev/sda9 during installation
UUID=804ff3a7-e5dd-406a-b63c-e8f3c635fbc5 none swap sw 0 0
#Windows-Partition
UUID=368CEBC57807FDCD /media/Share ntfs defaults,uid=1000,gid=1000,noexec 0 0
As you can see I have added the noexec
bit to the configuration. Why? Because any file I create on or move to the partition is automatically marked as executable.
The problem is that there is no way of changing that through nautilus. I cannot uncheck the "Allow executing file as program" option.
The noexec
option doesn't help, unfortunately. It only prevents nautilus from displaying the "run" or "read" dialog but doesn't change the executable flag.
Is there any way I can fix this?
The
noexec
option has nothing to do with the actual permissions; it's just for not allowing to run anything from that partition: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
andfmask
for setting default permissions separately to for directories and files on a mounted NTFS system.With January's help I was able to find the following fstab options that solved my problem:
The fstab entry for my NTFS partition is now as follows:
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.