LeonOS Documentation

POSIX file permissions

Source reconciliation, 2026-09-12

The retired authd database was AUS2, not AUS1; its source now lives exclusively under tools/tests/legacy_authd. Standard passwd/shadow/group/gshadow files and Linux-PAM are now the production authority. The administrator is UID/GID 0, named root, with home /root. The kernel has saved/filesystem ID and capability fields and some handlers, but their Linux contracts are incomplete. In particular, the existence of these fields is not evidence for set-ID exec support. See SUDOERS_PAM_STATUS.md for the active implementation and verification matrix. Historical verification below does not certify the new sudoers/PAM scope.

The three octal digits select permissions for the file owner, members of its group, and other users, in that order. Each digit adds read=4, write=2 and execute/search=1. For example, 640 means owner read/write, group read, others no access; 755 means owner read/write/execute and group/others read/execute. Directory write and search permission govern creating/removing names, while directory read permission governs enumeration.


chmod 640 /home/alice/document.txt
chmod 700 /home/alice/private
chown alice:alice /home/alice/document.txt
chown 1001:1002 /home/alice/document.txt
umask 027

chown to another owner requires effective CAP_CHOWN. An owner can change the group to one of its primary/supplementary groups; unauthorized changes return EPERM. An inaccessible directory component returns EACCES before .. is folded. Changing a mode to 000 removes normal access; it does not invalidate an already-open descriptor.

Implementation and migration

Verification boundary

The Linux permission host fixture runs the real implementation under ASan/UBSan. Independent static/dynamic musl guest probes exercise owner/group/ other, supplementary groups, umask, sticky directories, chmod/chown and error paths. Selected unmodified LTP fchmod01 and chown01 cases exit 0. See the full result matrix in LINUX_ABI_PROGRESS_2026-09-08.md; failed cases remain failures.

Same-directory rename replacement now preserves source contents and permission metadata on FAT32/exFAT; the musl guest test covers type conflicts and empty vs nonempty directories. The ext2 backend test uses a real mke2fs image and checks results with debugfs and e2fsck, with and without the filetype feature.

The earlier unfinished list is superseded by the detailed matrix in SUDOERS_PAM_STATUS.md: focused held-inode, set-ID, saved/fs-ID and capability probes now pass, but full concurrent lifetime, power-cut persistence and FAT/exFAT timestamp/special-bit contracts remain incomplete. Synthetic device metadata is volatile. The FAT/exFAT metadata format still has a 64-record per-directory limit and reports exhaustion; it must be extended before claiming Linux-scale directory coverage. VMware is unverified.

Unix pathname sockets are real filesystem nodes: mode/UID/GID and directory search/write checks apply, close leaves the node, and unlink/rename update the binding namespace. ext2 stores S_IFSOCK in its inode; FAT/exFAT retain the type in POSIX metadata. Public services explicitly set mode 0666 because ordinary users must connect before application-level peer authorization. The generic IPC listen helper defaults to 0600. The regression that made windowd's 0755 socket reject user Terminal connections was reproduced and repaired; normal QEMU OOBE/Terminal/task-manager/graphics checks pass.

Sources: Linux v6.12 namei.c and the pinned upstream musl src/passwd/getpw_a.c/getgr_a.c in third_party. Network retrieval used http://127.0.0.1:12334.