HP-UX Reference (11i v3 07/02) - 1 User Commands N-Z (vol 2)
u
umask(1) umask(1)
Numeric Mask Value (Obsolescent)
A numeric mask replaces the current file mode creation mask. It is specified as an unsigned octal integer,
constructed from the logical OR (sum) of the following mode bits (leading zeros can be omitted):
0400 ( a=rwx,u-r ) Read by owner
0200 ( a=rwx,u-w ) Write by owner
0100 ( a=rwx,u-x ) Execute (search in directory) by owner
0040 ( a=rwx,g-r ) Read by group
0020 ( a=rwx,g-w ) Write by group
0010 ( a=rwx,g-x ) Execute/search by group
0004 ( a=rwx,o-r ) Read by others
0002 ( a=rwx,o-w ) Write by others
0001 ( a=rwx,o-x ) Execute/search by others
Displaying the Current Mask Value
To display the current file mode creation mask value, use one of the commands:
umask -S Print the current file mode creation mask in a symbolic format:
u=[r][w][x],g=[r][w][x],o=[r][w][x]
The characters r (read), w (write), and x (execute/search) represent the bits that are
clear in the mask for u (user/owner),
g (group), and o (other). All other bits are set.
umask Print the current file mode creation mask as an octal value.
0[o][o][o]
The zero bits in the numeric value correspond to the displayed r, w, and
x permission
characters in the symbolic value. The one bits in the numeric value correspond to the
missing permission characters in the symbolic value.
Depending on implementation, the display consists of one to four octal digits; the first
digit is always zero (see DEPENDENCIES). The rightmost three digits (leading zeros
implied as needed) represent the bits that are set or clear in the mask.
Both forms produce output that can be used as the mask argument to set the mask in a subsequent
umask
command.
General Operation
When a new file is created (see creat(2)), each bit that is set in the file mode creation mask causes the
corresponding permission bit in the the file mode to be cleared (disabled). Conversely, bits that are clear in
the mask allow the corresponding file mode bits to be enabled in newly created files.
For example, the mask u=rwx,g=rx,o=rx
(octal 022) disables group and other write permissions. As a
result, files normally created with a file mode shown by the
ls -l command as
-rwxrwxrwx (octal 777)
become mode
-rwxr-xr-x (octal 755); while files created with file mode -rw-rw-rw- (octal 666
)
become mode
-rw-r--r-- (octal 644).
Note that the file creation mode mask does not affect the set-user-id, set-group-id, or "sticky" bits.
The file creation mode mask is also used by the chmod command (see chmod(1)).
Since umask affects the current shell execution environment, it is generally provided as a shell regular
built-in (see DEPENDENCIES).
If umask is called in a subshell or separate utility execution environment, such as one of the following:
(umask 002)
nohup umask
...
find . -exec umask ...
it does not affect the file mode creation mask of the calling environment.
The default mask is u=rwx,g=rwx,o=rwx (octal 000).
HP-UX 11i Version 3: February 2007 − 2 − Hewlett-Packard Company 357