Skip to content

File System and Permissions (ACL) ​

This page brings together the Linux directory structure and how to grant access to those files (basic permissions and ACL).

File System and Directory Structure ​

Linux treats everything as a file. The top-level directory is / (root), and everything branches out below it.

/
├── home/        # home directories of regular users
├── var/         # variable data such as logs and caches
│   └── log/     # where system/app logs are stored
├── etc/         # configuration files
└── usr/         # programs and libraries

Paths handled directly in this mission

PathPurpose
/home/agent-admin/agent-appAGENT_HOME (app root)
/var/log/agent-appStores monitoring logs
/etc/ssh/sshd_configSSH configuration file

File Permissions and ACL ​

Basic Permission Structure ​

-rwxr-x---  1  agent-dev  agent-core  monitor.sh
 ^^^         owner         group
 |||
 ||+-- others          : ---  (no permissions)
 |+--- group           : r-x  (read/execute)
 +---- owner           : rwx  (read/write/execute)

Numeric Permission Notation ​

NumberMeaning
4Read (r)
2Write (w)
1Execute (x)
bash
chmod 750 monitor.sh
# 7 = rwx (owner)
# 5 = r-x (group)
# 0 = --- (others)

Key Commands ​

bash
# Change owner/group
chown agent-dev:agent-core monitor.sh

# Change permissions
chmod 750 monitor.sh

# Check permissions
ls -l monitor.sh

ACL (Access Control List) ​

Basic permissions can only be set at three levels: owner, group, and others. ACL is used to grant additional, individual permissions to specific users or groups.

bash
# Install ACL
apt install acl

# Grant rwx permissions to a specific group
setfacl -m g:agent-core:rwx /var/log/agent-app

# Check ACL
getfacl /var/log/agent-app

Summary ​

ItemDetails
Directory structurehome, var/log, etc, usr under /
Basic permissions3 levels: owner / group / others, r=4 w=2 x=1 (e.g. chmod 750)
Change ownerchown agent-dev:agent-core monitor.sh
ACLAdds individual permissions for specific users/groups (setfacl -m, getfacl)

Source: Codyssey-B1/B4-1