Mikey’s Linux Field NotesAll topics

GUIDE 06 / ADMINISTRATION

Permissions & ACLs

Read mode bits and control access for owners, groups, and named users.

4 quick lessons · Examples to adapt to your server
In this guide
Decode ordinary permissionsUse special bits deliberatelyInspect effective ACL accessGrant a specific reader access

Commands use class paths and example filenames. Replace placeholders and inspect the target before making changes.

01

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.

COMMANDS & EXAMPLES
ls -ld /usr/share/itfdn-docs
stat -c "%a %A %n" /usr/share/itfdn-docs
chmod u=rw,g=r,o=r notes.txt
umask
Field note

644 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.

02

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.

COMMANDS & EXAMPLES
chmod g+s ~/practice/shared
ls -ld /tmp
find /usr/bin -type f -perm -4000 2>/dev/null
Field note

Create ~/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.

03

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.

COMMANDS & EXAMPLES
getfacl /var/log/nginx
getfacl /var/log/nginx/access.log
ls -l /var/log/nginx/access.log
Field note

With an extended access ACL, the group permission field displayed by ls -l reflects the mask. A + after the mode indicates additional ACL information.

04

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.

COMMANDS & EXAMPLES
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/logs
Field note

A 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.