Umask

From Colettapedia
Jump to navigation Jump to search

General

  • umask = user mask
  • sets the file mode creation mask of the current process.
  • The umask only restricts permissions; it cannot grant extra permissions beyond what is specified by the program that creates the file or directory.
  • Octal umasks are calculated via the bitwise AND of the unary complement of the argument (using bitwise NOT) and the permissions specified by the program: typically 666 in the case of files, and 777 in the case of directories.
  • A common umask value is 022 (masking out the write permission for the group and others), which ensures that new files are only writable for the owner (i.e. the user who created them). Another common value is 002, which leaves the write permission for the file's group enabled. This can be used for files in shared workspaces, where several users work with the same files.