chmod · shipping · also change file mode, fchmod, fchmodat

chmod

chmod changes a file's permission and special mode bits without changing its owner or group.

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. [1]

ACL 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. [2]

Special 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. [1]

Retained 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. [1] [3]

Link 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. [4]

Relations

related
chown, ACL mask, Open file description, Symbolic link

Limitations

  • Permission bits do not encode every filesystem or security-policy access check.

Citations

  1. Linux man-pages: chmod(2), mode changes, special bits and NFS (accessed 2026-11-16)
  2. Linux ACL project: acl(5), correspondence between ACL entries and permission bits (accessed 2026-11-16)
  3. Hesela: restoring Linux ACLs and retained-access observations (accessed 2026-11-16)
Sources & caveats
  • 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.

JSON: /data/terms/chmod.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

Cite this page
Hesela team. chmod. Hesela. 2026-11-16. https://hesela.dev/terms/chmod/