umask - Get or set the file mode creation mask

Synopsis

umask [ -S ] [ mask ]

Description

You can use umask to set or display the file creation mask. The mask allows you to control the file permission bits that are set when creating a file or directory.

If you specify mask, qsh sets the file creation mask to mask. If you do not specify mask, qsh displays the current file creation mask on standard output.

Options

  • -S Use symbolic permissions.

Operands

When using symbolic permissions, mask is an expression that defines which permissions should not be removed. A symbolic permission is an expression with the format [ who ] op [ permission ] where:

  • who is a combination of the letters:
    • u for owner permissions.
    • g for group permissions
    • o for other (or public) permissions
    • a for all permissions (the default value).
  • op is one of the following:
    • - (minus) to delete the permission.
    • + (plus) to add the permission.
  • permission is one or more of the following:
    • r for read permission.
    • w for write permission.
    • x for execute or search permission.

Exit status

  • 0 when successful.
  • >0 when mask is invalid.

Examples

  1. Display the current file creation mask in symbolic form: umask -S
  2. Display the current file creation mask: umask
  3. Set the file creation mask to remove read permission for others: umask 004
  4. Set the file creation mask to remove write permission for group: umask -S g-w