1

I see numerous how-to examples for mounting an ntfs partition with either a mount command or an entry in fstab. In all cases, specifying ntfs as the filesystem is associated with also specifying umask=0222, and specifying ntsf-3g never has a umask parameter.

Trying to research umask, I came across numerous explanations like this one. I can't get from those explanations to understanding "0222", which among other things, has one more digit than the specification seems to describe. I understand that it supposedly reduces permissions from the default definition. That's not much help, either. I'm guessing that it relates to writing, since in Linux, ntfs-3g supports it and at least as of a few years ago, ntfs did not.

What are the default permissions (I assume they relate to the directories and files and are independent of the filesystem), and what does "0222" do to that? Why is it needed? Is it just to avoid an error message trying to write to a partition when Linux doesn't support it?

1

I do not know the difference between ntfs and ntfs-3g.

Regarding the umask option, it specifies a bit mask such that the bits set in the umask are cleared in the file access permissions. These permission bits are RWXRWXRWX, where R is read access, W is write access, and X is execute access, with some higher bits used in special cases. The high order RWX is for the owner of the file being accessed, the next RWX group gives access for the group of the file, and the last is for everybody. Because these permissions come three bits at a time, they are traditionally in octal. The leading 0 can indicate either octal, or 0 for some of the special case bits since it is traditionally represented in octal anyway, depending on the context.

So a umask of 222 or 0222, which are the same since the number is traditionally octal, is 010010010 in binary. This means the W bit is set for the user, the group, and everybody else. Setting this bit in umask clears the W bit in the file access permissions.

This is not to avoid error messages. By specifying a umask of 222, it makes files non-writable by anybody, when otherwise they might have been writable.

  • Thanks for your reply. So you're saying the default permissions is all write permissions are enabled? The 222 disables all write permissions? My understanding is that Linux can't write to NTFS, but can write to NTFS-3g. It would make sense, then, to block writing in the case of NTSF but not NTFS-3g. – fixer1234 Sep 15 '15 at 1:07
  • The difference between ntfs and ntfs-3g fs drivers: superuser.com/questions/139452/kernel-ntfs-driver-vs-ntfs-3g (But a bit dated, as by now perhaps Linux-NTFS driver has been enhanced?) – Elliptical view Sep 12 '16 at 19:32

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.