Before going deeper into AppArmor, there are a few basic Linux skills you must master first: the CLI and shell, systemd service management, user and file permissions, and the concepts of processes, executables, and libraries. This episode guides you through setting up a safe lab environment, installing the userspace tools, and verifying that AppArmor is active.

Welcome to the Learn AppArmor series! This series will take you from zero to production-ready with AppArmor (Application Armor) — the Linux Security Module that provides path-based Mandatory Access Control (MAC). Across 23 episodes, you'll move from understanding your first profile to managing secure, audited confinement for production workloads.
Before you type your first aa-status command or write an AppArmor profile, there are a few foundational skills and tools you need to have in place. Why are these pre-requisites so important? AppArmor is not a standalone feature — it attaches to processes, judges file access based on paths, and runs on top of the Linux foundations you already know: file permissions, systemd, and the CLI. Imagine wanting to be a building's security officer without understanding the floor plan or who the occupants are — no matter how strict the rules, it would still be hard to get the job done.
Episode 0 will be your roadmap: making sure your skills are sufficient, setting up a safe lab environment on a distro with AppArmor active, installing the userspace tools, and then verifying that your system is ready. Once this episode is done, you'll be truly ready to move on to episode 1, which covers the history and background of why AppArmor exists.
Let's start with skills. Without these, no tool, however sophisticated, will be of any use.
You'll spend nearly all of this series in the terminal. AppArmor is managed through CLI commands such as apparmor_parser, aa-genprof, aa-logprof, and aa-status — without comfort on the command line, all of those tools will feel like meaningless incantations. Make sure you're comfortable with:
ls, cd, cat, grep, less, tail, and find.| pipeline to chain small commands into one complex job.You don't need to be a script master. Just reach the level of "I can write a command, read its output, and understand errors without panicking". The rest will build itself over the course of this series.
AppArmor does not work alone — it depends heavily on the services beneath it, and almost all of those services are managed by systemd. You'll interact frequently with services like apparmor, sshd, and nginx in the upcoming episodes. Master these four basic operations:
| Command | Function |
|---|---|
systemctl status <service> | Show a service's status, PID, and recent logs |
systemctl start <service> | Start the service |
systemctl enable --now <service> | Activate the service and make it start automatically at boot |
systemctl restart <service> | Restart the service after a configuration change |
One thing you should note from now: in the AppArmor world, any process running without a profile is an invulnerable one — it can do anything. Services running under systemd are the primary candidates you'll confine later, so first understand how the two intersect.
This is the most important foundation. Before understanding AppArmor's MAC (Mandatory Access Control), you must first understand Linux's native DAC (Discretionary Access Control) — the rwx permissions for user, group, and other that you manage with chmod and chown. Remember one principle: AppArmor works on top of DAC, not as a replacement. An access must pass through two stacked gates: DAC first, then MAC.
chmod 750 /srv/www
chown arman:devops /srv/www
umask 022chmod 750 means the owner has full access, the group can read and execute, and everyone else has no access. umask 022 ensures new files aren't accidentally opened wide. If these concepts still feel unfamiliar, take the time to re-read your Linux permissions material before continuing — because in episode 1 we'll discuss why DAC alone is not enough for a truly secure system.
This is a skill that is often underestimated yet highly decisive. AppArmor confines processes based on their executable's path — so you must understand the difference between:
| Term | Explanation |
|---|---|
executable | The binary or script that runs, e.g. /usr/sbin/nginx |
process | A running instantiation of an executable, with its own PID |
library | A .so file loaded by a process at runtime, e.g. /lib/x86_64-linux-gnu/libc.so.6 |
Why does this matter? When writing profiles later, you'll list the library paths a process is allowed to load — and m (mapping) denials often appear precisely because a library isn't listed. Get into the habit of inspecting processes with ps aux and checking a process's binary path with readlink /proc/<pid>/exe.
Once your basic skills are in place, it's time to prepare the environment where you'll practice. This decision matters because it determines how representative your learning experience is of production conditions.
The good news: AppArmor is far easier to enjoy by default than its other MAC cousin. Recommended distros for this series:
apparmor-utils tools are available in the official repositories.All of the distros above run AppArmor active and default, so you won't need to bother configuring the kernel. Distros in the Red Hat family such as Fedora and RHEL, on the other hand, choose SELinux — you could still run AppArmor there, but it isn't a natural learning experience.
Best practice: never learn AppArmor on your main host or on a production server. Use a Virtual Machine (VM). Inside a VM you're free to load and unload profiles, write broken profiles, even make the system unbootable — and none of it will affect your main computer.
One habit that will save you: take a snapshot before experimenting. A broken profile — like locking /bin/bash without execute permission — can render the system non-functional, and the snapshot is your undo button. If things break, just restore.
Tip
If you want to practice confinement without sacrificing a host, use a Docker container as your practice area — Docker even loads a default AppArmor profile for every container. Still, prioritize a VM to understand how things really work at the operating system level.
The kernel is only the enforcer; the tools for reading status, creating profiles, and troubleshooting all live in the userspace package. After installing a clean system, install the following package:
sudo apt install apparmor-utilsFor openSUSE, the equivalent is sudo zypper install apparmor-utils — the same package under the same name. Once the install finishes, get to know these members of apparmor-utils — they'll accompany you throughout this series:
| Tool | Role |
|---|---|
aa-status | Show AppArmor status and the list of loaded profiles |
aa-genprof | Generate a new profile interactively from an executable |
aa-logprof | Update a profile from the denial logs recorded by the system |
aa-notify | Display AppArmor denial notifications from the logs |
If aa-status or aa-genprof aren't present after the install, make sure the package is truly installed with apt list --installed | grep apparmor.
Time to confirm everything is ready. First, check whether AppArmor is active in your kernel:
aa-enabledAn output of Yes (or exit code 0) means AppArmor is active in the kernel. Next, look at the full status:
sudo aa-statusapparmor module is loaded.
51 profiles are loaded.
49 profiles are in enforce mode.
2 profiles are in complain mode.
24 processes have profiles defined.
24 processes are in enforce mode.Three lines you must pay attention to: apparmor module is loaded (the kernel is active), the number of loaded profiles, and the split between enforce and complain modes — two modes we'll dissect thoroughly in episodes 2 and 3. If your output looks like the above, your environment is officially ready.
aa-status won't exist. Make sure you're on Ubuntu/Debian/openSUSE.apparmor-utils install. If aa-genprof or aa-logprof are not found, you haven't installed the userspace tools.In episode 0 we laid a solid foundation for the entire journey: making sure you master the basic Linux skills (CLI, systemd, permissions, processes and libraries), choosing a distro with AppArmor active, setting up a safe VM lab, installing the userspace tools, and verifying that AppArmor is running.
Key points to take with you:
aa-status, aa-genprof, aa-logprof, aa-notify) are your primary weapons — make sure they're installed.Remember, the Learn AppArmor series consists of 23 episodes that build on each other. Make sure your environment is ready, because in the next episode, episode 1, we'll cover the history, background, and why the world needs AppArmor — from its birth at Immunix, its adoption by Novell and SUSE, its integration into kernel 2.6.36, to the modern userspace ecosystem in use today. Keep your momentum going, because the AppArmor learning journey has only just begun!