Thursday, April 7, 2011

NTFS-3G options: umask, dmask, and fmask

If you mount your ntfs partition with default options, you may have different 'default file creation permission' with your linux partition. Sometimes, this makes nasty issues. For example, when you clone a git repository from a remote, your checked-out files and directories might have different permissions with the original ones.

Basically, for the newly created directories and files, linux assigns permission 777 for the directories and assigns permission 666 for the files. And umask  (/etc/profile) is applied here.  Default value of umask is 022(0022). So if you create a directory, it will have the default permission value 755. If it is a file, it's permission will be 644.

If you mount your ntfs partition with default options, umask, dmask, and fmask are all 0000.  It implies that all the directories and files you created on the ntfs partition will have the permission 777. For the compatibility, you have to set:

umask= 0022
dmask=0000 (makes default directory permision 777)
fmask=0111 (makes default file permission 666)