Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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?

share|improve this question

2 Answers 2

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.

share|improve this answer
    
Thank you! Following your advice I was able to find the right umask and fmask options for mounting the partition without setting all files to executable. I posted them below as an answer to my own question. –  Glutanimate Aug 30 '12 at 12:32
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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