2

I am using dircolor-solarized to render my ls output. It works well in my linux partition. However, in a NTFS partition mounted by ntfs-3g, all the files were colored green green because /etc/fstab grants the executable permission to the partition:

/dev/sdb5   /mnt/win10_E    ntfs-3g     rw,uid=1000,gid=1000,dmask=0022,fmask=0033  0   0

and in my dircolors.256dark there is:

EXEC 00;38;5;64

I have tried umask=0022 but the output keeps the same. Actually I don't think things will change if executable permission is granted to any of the users. But when I tried 'umask=0111', the partition just failed to be mounted. So I am here to ask for a help:

1) Is there any way to mount a ntfs partation writable and readable, while executable permission is absent?

2) If 1) is not possible in ntfs-3g, is there a way to lower the priority of EXEC rendering? For example, let dircolor firstly match the extension names, and then EXEC if no match found in the list.

3) Any other workaround?

My distribution:

$ uname -a
Linux debian-Z620 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 GNU/Linux

Thanks!

  • 1
    What was the exact command used, and error message shown, when the partition "failed to be mounted"? -o fmask=111 works for me (kernel 3.13.0-92-generic #139-Ubuntu, ntfs-3g 1:2013.1.13AR.1-2ubuntu2). – JigglyNaga Aug 23 '16 at 9:43
0

As suggested by @jigglynaga, you can get part of what you want using a different mount option.

According to the manual page, these are the relevant options:

umask=value
Set the bitmask of the file and directory permissions that are not present. The value is given in octal. The default value is 0 which means full access to everybody.

fmask=value
Set the bitmask of the file permissions that are not present. The value is given in octal. The default value is 0 which means full access to everybody.

dmask=value
Set the bitmask of the directory permissions that are not present. The value is given in octal. The default value is 0 which means full access to everybody.

You were using umask, which applies to both files and directories. But since you need executable permissions on directories, and disallowed this, the driver did not cooperate. Changing that to fmask affects only files.

Just in case, you might want to review the dmask setting as well (full access to everybody may not be what you want).

As for ls (and dircolors). No: the ls program checks for EXEC before checking any pattern, so you could not make a special case with a pattern such as *.exe

That is not well documented; you can read the source code to see

  • Yes, you're right. The executable permission of directories cannot be removed, or I cannot access browse the partition with a non-root user. So I choose dmask=0022,fmask=0111 this time, and everything goes well :-) @JigglyNaga Thank you all the same! – purplezzh Aug 24 '16 at 2:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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