UMASK(1)

NAME
umask - set file creation mode mask

SYNOPSIS
umask [ ooo ]

DESCRIPTION
Umask sets the access control mask used by the shell and commands invoked from it whenever a new file is created. If no argument is given the current mask is printed (as an octal number). The argument is an octal number which becomes the current mask.

The mask specifies file access mode bits from the base set 777 which will not be set when a new file is created. The bits specify read, write and execute access (in that order) for access by the file owner, a member of the file group and anyone else (in that order). Thus:

700 The bits controlling access by the file owner.

070 The bits controlling access by a user who is not the file owner but is in the group of the file (see ls(1) option -lg or ls(1v) option -l).

007 The bits controlling access by anyone else.

Similarly:-

444 The bits controlling read access.

222 The bits controlling write access.

111 The bits controlling execute access.

In use the mask is used to remove access bits from the access requested by an open(2) system call which creates a file. Normally programs request an access of 666 for data files and 777 for executable files. Thus a mask of 022 (the default) will cause data files to have access 644; owner read/write and group/other read-only.

The umask value is inherited by any command run, directly or indirectly, from the shell. On systems where group write access is required to be the default it is normal for users to place the command:

    umask 2

in their .login (csh(1)) or .profile (sh(1)).

SEE ALSO
sh(1), csh(1), ls(1), ls(1v), open(2), umask(2).