Iftekhar EatherTechnical Lead · System Architecture · Cloud
Back to Blog
#linux#guide#kernel#linuxtutorial

Part 2: Navigating Filesystems & Access Controls (Permissions & Users)

The Filesystem Hierarchy (where everything is a rooted tree without drive letters) and Access Controls (how multi-user security is enforced through permissions)

Iftekhar Ahmed Eather5 min read
Part 2: Navigating Filesystems & Access Controls (Permissions & Users)

Welcome back to the Linux: Master Series Guide. In Part 1, we established a precise mental model of Linux, broke down its architecture layers, and rapidly deployed a workspace.

Now, we shift our focus from setting up the system to effectively living and operating inside it. To manage Linux, you must master two core concepts: The Filesystem Hierarchy (where everything is a rooted tree without drive letters) and Access Controls (how multi-user security is enforced through permissions).

01: The Filesystem Hierarchy

In Linux, "everything is a file." There are no drive letters (C:\, D:\). Instead, the filesystem is a single rooted tree, starting at the root directory: /.

Understanding a handful of top-level directories accounts for almost everything you will touch as an engineer. A common mental default for address ranges still maps useful patterns, but you must prioritize these core paths:

Core System Directories

These directories are fundamental to system operations:

Directory

Characteristics & DevOps Focus

/bin/ -> /usr/bin/

Essential user binaries (commands like ls, grep, systemctl).

/sbin/ -> /usr/sbin/

Administrative binaries (commands used by root for system maintenance).

/boot/

Files needed to boot the system (kernel image, initramfs, GRUB config).

/lib/ -> /usr/lib/

Shared libraries used by binaries and kernel modules.

/data/

Not FHS standard. A common custom bind-mount point (especially in Docker) for volume-persisted data.

System Configuration, User, and Volatile Data

Directory

Characteristics & DevOps Focus

/etc/

System-wide configuration files. The "registry" of Linux.

/var/

Variable data: logs (/var/log/), databases, and ephemeral data that changes frequently.

/home/

Default location for regular users' home directories (e.g., /home/jdoe/).

/root/

The independent home directory of the root (super) user.

/tmp/

Temporary files, cleared on reboot.

Virtual Filesystems (The Kernel Window)

These are not real directories on disk—they are virtual windows generated on-the-fly by the kernel to expose system state:

Directory

Characteristics & DevOps Focus

/proc/

Virtual filesystem exposing process and kernel state. Reading /proc/1234/status queries process 1234 live.

/sys/

Virtual filesystem exposing hardware and kernel object state.

/dev/

Device files (interfaces to hardware), such as /dev/null, /dev/random, or disk devices (/dev/sda1).

02: Users, Groups, and Identification

Linux is a multi-user OS from the ground up, and user management is central to keeping a system secure. Four system files back this multi-user scheme:

  1. /etc/passwd: Account details (User, primary group ID, home directory, login shell).

  2. /etc/shadow: Stores encrypted password hashes safely (not readable by normal users).

  3. /etc/group: Group definitions (names and member lists).

  4. /etc/gshadow: Secure group details (secure group admins).

Everyday Identification Commands

Command

Action / DevOps Focus

id

Show the UID (User ID), GID (Group ID), and supplemental groups of the current user.

groups [username]

List group memberships.

w

Show who is logged in and what they are actively doing.

last

Show a history of previous user logins.

In most enterprise and container environments, you will prioritize key-based authentication for remote access via SSH. Key-based authentication (Ed25519 or RSA) is critical for automation and eliminates brute-force and credential-stuffing attacks.

03: The Access Control Layer (Permissions)

Every file and directory on a Linux system is backed by three access classes: an Owner (User), a Group, and Others.

Each class is assigned three permission bits: Read (r), Write (w), and Execute (x).

Inspect them with ls -l:

ls -l myapp.sh
# -rwxr-xr-x 1 user group 1234 Mar 28 10:00 myapp.sh

Modes and Octal Values

Permissions can be set using symbolic mode (u+x) or numeric (octal) mode. In octal, permission bits are summed per class:

  • Read (r) = 4

  • Write (w) = 2

  • Execute (x) = 1

Permission String

Octal Value (U|G|O)

Meaning

rwx

7 (4+2+1)

Full access.

r-x

5 (4+0+1)

Read & Execute (but no Write/modification).

rw-

6 (4+2+0)

Read & Write (but no execution).

---

0 (0+0+0)

Zero access.

Example Octal Setups:

  • chmod 755 [file]: Full access for owner, read/execute for group/others (standard for executables).

  • chmod 644 [file]: Read/write for owner, read-only for group/others (standard for config files).

  • chmod 700 [file]: Full access for owner, zero access for everyone else.

Special Permission Bits

While rwx is standard, three special bits exist to solve specific operational challenges:

Special Bit

Position

DevOps Focus

SetUID (s)

Owner Exec Bit

Runs the file with the owner's privileges, not the launcher's. Example: /usr/bin/passwd runs as root so users can update their own entry in /etc/shadow.

SetGID (s)

Group Exec Bit

Files/subdirectories created inside inherit the directory's group. Critical for shared directories in group collaboration.

Sticky Bit (t)

Others Exec Bit

Restricts file deletion inside a shared directory to only the file's original owner (used in /tmp/).

04: Advanced Access Control Lists (ACLs)

Managing standard permissions is foundational. However, standard rwx bits only cover one owner and one group.

To resolve complex access matrices (granting named users or additional named groups access without changing standard permissions), prioritize Filesystem Access Control Lists (ACLs):

# View active ACLs
getfacl backup.db

# Grant user 'postgres' RWX access to backup.db
sudo setfacl -m u:postgres:rwx backup.db

# Grant group 'admins' RX access to /var/data
sudo setfacl -m g:admins:rx /var/data/

Mastering the filesystem hierarchy, multi-user identification, and permissions resolution ensures the system—and the applications running on top of it—operate securely and consistently.