{
  "slug": "chmod",
  "term": "chmod",
  "aliases": [
    "change file mode",
    "fchmod",
    "fchmodat"
  ],
  "definition": "chmod changes a file's permission and special mode bits without changing its owner or group.",
  "note": "Mode and identity: chmod() names a file by pathname and follows a final symbolic link, while fchmod() uses an open descriptor. The caller normally needs ownership or CAP_FOWNER on Linux. These calls change file metadata, not the descriptor's read/write access mode. [chmod]\n\nACL interaction: where a Linux access ACL has a mask, the group mode bits represent ACL_MASK rather than the owning-group entry. A mode change can therefore alter effective permissions for named users and groups while their entries remain stored. Without a mask, group bits correspond to ACL_GROUP_OBJ. [acl]\n\nSpecial bits: when the caller lacks CAP_FSETID and the file group is outside its effective and supplementary groups, Linux clears a requested setgid bit without reporting an error. Later writes may also clear setuid/setgid execution bits. Check the resulting state, not just a successful return. [chmod]\n\nRetained access: a narrower mode is not a universal revocation mechanism. Local open descriptions may retain access, while Linux documents server-side NFS checks that affect already-open files. Ownership changes and final mode/ACL restoration must be coordinated. [chmod] [hesela-acl]\n\nLink metadata: Linux ordinary symbolic links retain mode 0777; these bits do not control access and cannot be changed. Link ownership still matters to sticky-directory and protected-symlink rules. [symlink]",
  "status": "shipping",
  "advantages": [],
  "limitations": [
    "Permission bits do not encode every filesystem or security-policy access check."
  ],
  "related": [
    "chown",
    "acl-mask",
    "open-file-description",
    "symbolic-link"
  ],
  "supersedes": [],
  "supersededBy": [],
  "firstSeen": null,
  "lastSeen": null,
  "updated": "2026-11-16",
  "citations": [
    {
      "id": "chmod",
      "title": "Linux man-pages: chmod(2), mode changes, special bits and NFS",
      "url": "https://man7.org/linux/man-pages/man2/chmod.2.html",
      "accessed": "2026-11-16"
    },
    {
      "id": "acl",
      "title": "Linux ACL project: acl(5), correspondence between ACL entries and permission bits",
      "url": "https://man7.org/linux/man-pages/man5/acl.5.html",
      "accessed": "2026-11-16"
    },
    {
      "id": "hesela-acl",
      "title": "Hesela: restoring Linux ACLs and retained-access observations",
      "url": "https://hesela.com/analyses/posix-acl-restore-permissions/",
      "accessed": "2026-11-16"
    },
    {
      "id": "symlink",
      "title": "Linux man-pages: symlink(7), link metadata and pathname components",
      "url": "https://man7.org/linux/man-pages/man7/symlink.7.html",
      "accessed": "2026-11-16"
    }
  ],
  "provenance": [
    "Documentation synthesis of Linux behavior, not a new experiment. The linked analysis separately reports its existing local ACL and retained-access observations.",
    "The syscall family is described here; command-line symbolic-mode parsing and recursive traversal options have separate utility contracts."
  ]
}
