chown · shipping · also change file ownership, fchown, lchown, fchownat

chown

chown changes a file's owning user or group identity and can also change security-relevant metadata.

Object selection: chown() follows a final symbolic link, lchown() changes the link itself, and fchown() uses an open descriptor. Passing -1 for an owner or group argument leaves that identifier unchanged. Recursive traversal is a command-line utility option, not a property of the syscall. [1]

Authority: Linux requires CAP_CHOWN for arbitrary owner changes. A file owner can select a group they belong to; arbitrary group changes require privilege. Group ownership is separate from group permission bits and from named ACL entries. [1] [2]

Security metadata: changing an executable file's owner or group can clear setuid/setgid execution bits and file capabilities. The documented non-group-executable setgid exception prevents treating this as a rule that every ownership change clears both bits. [1]

Restore order: complete ownership changes before final permission restoration, with authority for the remaining operations. The install implementation follows that ordering because ownership changes can clear special bits. Coordinate the final mode with the intended access ACL, since group bits may represent its mask; verify all final metadata and operation results. This is not a complete restore or durability protocol. [3] [2]

Path boundary: fchownat() with AT_SYMLINK_NOFOLLOW selects the final link, not a no-symlink policy for earlier components. A directory descriptor anchors relative lookup, not confinement: absolute paths ignore it. [1] [5]

Relations

related
chmod, Setgid directory, Symbolic link

Limitations

  • An identical numeric owner/group pair does not establish identical identity mapping between hosts.

Citations

  1. Linux man-pages: chown(2), owner/group changes and security metadata (accessed 2026-11-16)
  2. Linux ACL project: acl(5), owner/group roles and ACL mask (accessed 2026-11-16)
  3. GNU coreutils 9.5: install.c, change_attributes ordering (accessed 2026-11-16)

Further reading

  1. Hesela: restoring Linux ACLs and recovery metadata (accessed 2026-11-16)
Sources & caveats
  • Documentation and implementation review, not an ownership-switching experiment. Linux-specific privilege and special-bit rules must not be generalized to every operating system.
  • The syscall family is described here; recursive ownership-changing utilities and identity mapping require their own controls.

JSON: /data/terms/chown.json

Published by Hesela team · Updated

Report a correction · Editorial standards · Reuse guidance

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