CHAPTER 01 25 MIN READ BEGINNER

Linux Foundations: Filesystem Hierarchy, Permissions & the Process Model

The filesystem layout, the permissions model, and the process model are the vocabulary every later chapter in this module assumes you already have. Authentication, logging, persistence, process and network internals, shell tradecraft, container security, and incident response all lean on these four concepts directly, so this chapter builds them from the ground up.

filesystem hierarchy permissions model process model shell basics

The Linux Filesystem Hierarchy

Every Linux system organizes files into a single tree rooted at /, with a small set of directories that mean the same thing across distributions. Knowing what lives where is the first habit that transfers across every investigation in this module.

DirectoryContainsWhy It Matters
/etcSystem-wide configuration filesThe first place to check for a changed setting
/varVariable data, including /var/logThe primary home for logs, covered in chapter 3
/homePer-user dataLater in this module, shell profile files live here too
/tmpTemporary filesOften world-writable, a common attacker staging area
/procVirtual filesystem exposing live kernel and process stateCovered in depth in chapter 5
/bin, /sbinEssential and system administration binariesThe commands the system needs to boot and run
/usrThe bulk of installed system and user binariesWhere most software actually lives once installed

This layout is largely standardized across distributions through the Filesystem Hierarchy Standard, so the same investigative habits, checking /etc for config changes, /var/log for history, /tmp for staged files, transfer whether the host is running Debian, RHEL, or anything in between.

The Permissions Model

Every file and directory on a Linux system has an owner, a group, and a set of permissions for three categories of user: the owner, the owning group, and everyone else. Each category can be granted read, write, and execute, which for a file means view contents, modify contents, and run as a program, and for a directory means list contents, create or remove entries, and enter it.

NotationMeaning
rwxr-xr-xSymbolic: owner has read, write, execute; group has read, execute; other has read, execute
755Numeric: the same permissions expressed as octal digits (7 = rwx, 5 = r-x, 5 = r-x)

The numeric form just adds up the bit values for each category (read = 4, write = 2, execute = 1), so 7 means all three, 5 means read and execute without write, and so on for owner, group, and other in that order.

The setuid bit: a setuid binary runs with its owner's privileges rather than the caller's, no matter who executes it. This is exactly why unexpected or unfamiliar setuid binaries are a real privilege-escalation indicator, a topic this module revisits in chapter 2 when covering privilege and authentication in depth.

The Process Model

Every running program on a Linux system is a process, and every process carries two identifiers that matter for investigation: a unique process ID (PID) and the process ID of whatever started it, its parent process ID (PPID). That parent-child chain is recorded for the life of the process.

Processes also move through a small set of states: running (actively executing or ready to), sleeping (waiting on an event or resource), stopped (suspended, usually by a signal), and zombie (finished executing but not yet cleaned up by its parent). None of these states require deep detail yet, just the vocabulary.

The parent-child relationship is one of the strongest anomaly signals on a Linux host. A web server process spawning a shell, for example, is not a state a normal request-handling path produces, and that mismatch between expected and actual parentage is often the first thing that stands out in an investigation. The process model gets a full chapter of its own later in this module, chapter 5.

Shell Basics

The shell is the program that reads commands and runs them. Bash is the default on most distributions, alongside zsh on some systems and the minimal sh used for portable scripting. Whichever shell is in use, a few primitives repeat everywhere.

Environment variables are the shell's way of passing configuration to the processes it starts, things like a search path or a locale setting get inherited by every child process automatically. Redirection and piping, > to overwrite a file with output, >> to append to it, and | to feed one command's output into another, are the basic building blocks of shell scripting.

Both legitimate administration and a lot of attacker tradecraft (covered in chapter 6) are built on these same primitives, so recognizing them here pays off well beyond this chapter.

How This Module Builds From Here

The rest of this module applies the vocabulary from this chapter to progressively deeper topics.

  • Users, Authentication & Privilege: how accounts, groups, and privilege escalation actually work under the permissions model covered here.
  • Logging and Syslog Analysis: reading and correlating the logs that live under /var/log.
  • Persistence Mechanisms: how attackers use legitimate startup and scheduling paths to survive a reboot.
  • Process and Network Internals: the full detail behind PID, PPID, process states, and how processes talk over the network.
  • Shell Tradecraft and Detection: how the redirection and piping primitives from this chapter show up in real attacker activity.
  • Container and Docker Security: how the filesystem and process model change (and don't) inside a container.
  • Linux Incident Response and Hardening: pulling every earlier chapter together into a response and hardening workflow.

Key Takeaways

  • The Filesystem Hierarchy Standard keeps directories like /etc, /var, /home, /tmp, and /proc consistent in meaning across distributions.
  • Permissions follow an owner/group/other model with read, write, and execute bits, expressed symbolically (rwxr-xr-x) or numerically (755).
  • A setuid binary runs with its owner's privileges rather than the caller's, making unfamiliar setuid binaries a real privilege-escalation indicator.
  • Every process has a PID and a PPID, and an unexpected parent-child relationship is one of the strongest anomaly signals on a Linux host.
  • Environment variables and redirection (>, >>, |) are the shell primitives that both administration and attacker tradecraft build on.
  • This module builds outward from these fundamentals into authentication, logging, persistence, process internals, shell tradecraft, containers, and incident response.

Knowledge Check

Click an answer to reveal the explanation.

A binary has the setuid bit set and is owned by root. What happens when a low-privileged user runs it?

Correct answer: B. A setuid binary runs with its owner's privileges rather than the caller's, which is why unexpected or unfamiliar setuid binaries are a real privilege-escalation indicator.

Where would an investigator look first to review historical activity on a Linux system?

Correct answer: C. /var/log is the primary home for logs under the Filesystem Hierarchy Standard, and it's the subject of chapter 3 in this module.

A web server process is observed with a shell as its direct child. Why is this significant?

Correct answer: B. Every process carries a PPID recording what started it, and a web server spawning a shell is not a normal path, making the parent-child mismatch a strong anomaly signal.