Fmask

From Wikipedia, the free encyclopedia

The following is copy pasted from man mount.

umask=value
       Set  the  umask  (the  bitmask  of  the permissions that are not
       present). The default is the umask of the current process.   The
       value is given in octal.
dmask=value
       Set  the  umask applied to directories only.  The default is the
       umask of the current process.  The value is given in octal.
fmask=value
       Set the umask applied to regular files only.  The default is the
       umask of the current process.  The value is given in octal.

Contents

[edit] Examples

The following is an example of a user's /etc/fstab file.

# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>                                                        <dump>  <pass>
/dev/hda1       /media/win      ntfs    rw,suid,dev,exec,auto,user,async,fmask=113,dmask=002,gid=46      0       1
/dev/hda2       /media/big      vfat    rw,suid,dev,exec,auto,user,async,fmask=113,dmask=002,gid=46,utf8 0       1
/dev/hdb1       /media/old      vfat    rw,suid,dev,exec,auto,user,async,fmask=113,dmask=002,gid=46,utf8 0       1

The meanig of dmask and fmask is as follows.
The directories will have rwx rwx r-x (775) permissions,
while the files will have rw- rw- r-- (664) permissions.
To know how the values are calculated read ahead.

[edit] Directories

Full access for directories is 777.

777 AND NOT 002 = 775
in detail:
7778 = 111 111 1112
0028 = 000 000 0102
NOT 000 000 0102 = 111 111 1012
    111 111 1112 (777)
AND 111 111 1012 (775)
    111 111 1012 (775)

[edit] Files

Full access for files is 666.

666 AND NOT 113 = 664
in detail:
6668 = 110 110 1102
1138 = 001 001 0112
NOT 001 001 0112 = 110 110 1002
    110 110 1102 (666)
AND 110 110 1002 (664)
    111 111 1012 (664)

[edit] See also