GUIDE 06 / ADMINISTRATION
Permissions & ACLs
Read mode bits and control access for owners, groups, and named users.
In this guide
Commands use class paths and example filenames. Replace placeholders and inspect the target before making changes.
Decode ordinary permissions
For a file, r reads data, w edits data, and x permits execution. For a directory, r lists names, w modifies entries, and x permits traversal. Directory access usually needs both r and x to browse.
ls -ld /usr/share/itfdn-docs
stat -c "%a %A %n" /usr/share/itfdn-docs
chmod u=rw,g=r,o=r notes.txt
umask644 is rw-r--r--. With usual creation modes, umask 0022 produces files 644 and directories 755. The mask removes requested permissions; it does not add execute bits.
Use special bits deliberately
A setgid directory makes newly created entries inherit its group. Sticky directories restrict deletion and renaming by users who do not own the entry or directory. A setuid executable can run with the owner’s effective UID.
chmod g+s ~/practice/shared
ls -ld /tmp
find /usr/bin -type f -perm -4000 2>/dev/nullCreate ~/practice/shared before the chmod example. Lowercase s means the associated execute bit is present; uppercase S means it is absent. Linux ignores setuid on interpreted scripts. Avoid recursive chmod without reviewing everything it will change.
Inspect effective ACL access
Named-user entries extend ordinary ownership permissions. The ACL mask limits the permissions of named users and group entries, but not the file owner or other entry.
getfacl /var/log/nginx
getfacl /var/log/nginx/access.log
ls -l /var/log/nginx/access.logWith an extended access ACL, the group permission field displayed by ls -l reflects the mask. A + after the mode indicates additional ACL information.
Grant a specific reader access
Directory traversal and listing are separate from file reading. These examples grant one named user access to a dedicated practice directory and an existing file.
mkdir -p ~/practice/logs
touch ~/practice/logs/access.log
setfacl -m u:mkeel:rx ~/practice/logs
setfacl -m u:mkeel:r ~/practice/logs/access.log
setfacl -m d:u:mkeel:rX ~/practice/logsA default ACL supplies permissions for future children, subject to the creation mode; it does not update existing files. All parent directories must also allow traversal. Changing a file’s group does not fix an SELinux denial.