{
  "slug": "umask",
  "term": "File mode creation mask (umask)",
  "aliases": [
    "umask",
    "file creation mask",
    "file mode creation mask"
  ],
  "definition": "Umask is a process file-creation mask that clears selected requested permission bits when ordinary mask-based creation rules apply rather than default-ACL inheritance.",
  "note": "Requested permissions: without a parent default ACL, Linux applies requested_mode & ~umask & 0777 to the permission bits. Mask 0022 changes a request for 0666 to 0644, while 0600 remains 0600. This is bit clearing, not octal subtraction; the mask cannot add an execute bit absent from the request. These values are caller-supplied examples, not mandatory modes for all files or directories. [linux-umask] [linux-mkdir]\n\nDefault ACL: a Linux parent directory's default ACL replaces ordinary umask processing. The new object's inherited access ACL is constrained by the requested mode's corresponding permission classes. A named entry can remain stored while the ACL mask removes its effective rights. A process umask and an ACL_MASK entry are different controls. [acl]\n\nProcess state: a child created by fork() inherits the mask and execve() preserves it. POSIX threads share the process mask; calling umask() to fetch a value and then restore it leaves a non-atomic interval that can race with file creation in another thread. Linux's /proc/self/status exposes an Umask field without changing the mask, but reading it does not freeze later process state. [linux-umask] [pthreads]\n\nSeparate controls: umask does not choose group ownership or replace later permission changes. Linux parent-directory set-group-ID and filesystem mount rules govern group inheritance; a new subdirectory also inherits a parent's set-group-ID bit. The 0777 calculation covers permission bits, not every st_mode field. Creation permissions differ from the access mode of the descriptor returned by open(). [linux-mkdir] [linux-open]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    "The ordinary bit-clearing formula does not describe Linux creation under a parent default ACL.",
    "Creation modes alone do not establish successful access under all identities and security mechanisms."
  ],
  "related": [
    "default-acl",
    "acl-mask",
    "posix-access-control-list",
    "setgid-directory"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-16",
  "citations": [
    {
      "id": "linux-umask",
      "title": "Linux man-pages: umask(2), creation mask, inheritance and query race",
      "url": "https://man7.org/linux/man-pages/man2/umask.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "acl",
      "title": "Linux ACL project: acl(5), object creation and permission correspondence",
      "url": "https://man7.org/linux/man-pages/man5/acl.5.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "linux-mkdir",
      "title": "Linux man-pages: mkdir(2), creation permissions and group inheritance",
      "url": "https://man7.org/linux/man-pages/man2/mkdir.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "pthreads",
      "title": "Linux man-pages: pthreads(7), shared process attributes",
      "url": "https://man7.org/linux/man-pages/man7/pthreads.7.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "linux-open",
      "title": "Linux man-pages: open(2), creation mode versus descriptor access",
      "url": "https://man7.org/linux/man-pages/man2/open.2.html",
      "accessed": "2026-11-15"
    },
    {
      "id": "hesela-acl",
      "title": "Hesela: restoring Linux ACLs and the default-ACL contrast",
      "url": "https://hesela.com/analyses/posix-acl-restore-permissions/#creation",
      "accessed": "2026-11-15"
    }
  ],
  "provenance": [
    "Documentation synthesis. Numerical examples are permission-bit calculations, not new native measurements; the linked analysis separately labels its earlier ACL observations."
  ]
}
