Pcornel
Browse topics
Options
Recent
Favorites
Linux · Technical reference

AppArmor

Direct answer

AppArmor is mandatory access control on Ubuntu, Debian and SUSE: path-based profiles in /etc/apparmor.d restrict what each confined program may read, write, execute and access on the network.

When to use this

Use it when an AppArmor-confined program fails, or when confining a service on Ubuntu/Debian.

First 30 seconds

1. aa-status — profile loaded and enforce?

2. journalctl -k | grep DENIED — operation, profile, name?

3. Add a rule in /etc/apparmor.d/local/<profile>.

4. apparmor_parser -r /etc/apparmor.d/<profile>.

5. Retest; no new denials.

Operational verification

program starts → profile attached → each access checked against the profile → allowed or DENIED logged

Evidence · next step

For AppArmor, continue with the first unproven Topic check: Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for AppArmor. If that boundary is healthy, advance to the adjacent check: Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. Preserve the same host/time/identity scope and rerun the original workload before accepting recovery.

Continue only after interpreting the current observation.
Context & applicabilityCommon mistakes · platform/version boundaries
Platform / version applicability
linux
applies
Structured applicability is explicit Topic metadata; it does not infer compatibility beyond the stored rows.
At a glance

Operational reference

Fast context before you go deeper.

Platformlinux
Key commandaa-status
Scope / prerequisiteUse it when an AppArmor-confined program fails, or when confining a service on Ubuntu/Debian.
Reference · 1
What next?3 suggested next steps
Child topics (this level)4
Catalog command links1
Evidence1
On this pageJump to a specific section
Linux command reference

Primary Commands

Configuration and operational commands for this Topic.

Operational workflow

Verification & Troubleshooting

Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.

7 steps Observe → verify → isolate → change minimally → repeat the original test.
ObservedRecord what the original test actually shows

Capture the concrete output, symptom, packet, log or counter before changing anything.

Step 1 Operational evidence path Verify boundary

program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle

Healthy evidence: expected profiles are loaded, target processes are attached, enforcing behavior matches intended access and logs explain denies without breaking the workload

Step 2 Commands Verify boundary
aa-status
aa-complain /etc/apparmor.d/usr.sbin.nginx
journalctl -k | grep -i apparmor
Step 3 Verification and output interpretation Verify boundary

Verification path. Reproduce using the exact identity, service, path/object label and execution context. Separate authentication success from subsequent authorization. For SELinux/AppArmor, correlate denial records with current mode/profile/labels and confirm the access vector/path actually matches the failing operation. For hardening, verify both the intended denial and one required allowed workflow. Audit presence supports reconstruction but is not equivalent to evidence that policy blocked the action.

Verification chain. program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle

Step 4 Verification path Verify boundary

Exercise one safe negative or boundary case implied by UID/GID mismatch, stale group membership, ACL/mode conflict, missing capability, noexec/readonly mount, SELinux denial, AppArmor denial, expired/untrusted certificate or secret exposure.

Step 5 Failure modes and next checks Narrow the fault

Suspicious evidence: profile is missing/unloaded, process is unconfined, complain mode is mistaken for enforcement, path aliases/transitions bypass intent or broad abstractions allow excess access

Step 6 Common mistakes Narrow the fault
  • Disabling the profile instead of fixing it.
Step 7 Where it fails Narrow the fault

Walk identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation and stop where observed state diverges.

Common failure classes are UID/GID mismatch, stale group membership, ACL/mode conflict, missing capability, noexec/readonly mount, SELinux denial, AppArmor denial, expired/untrusted certificate or secret exposure.

Also consider stale generated config, wrong environment, wrong namespace/chroot/container, package/provider mismatch, dependency ordering, immutable/read-only mounts, exhausted inode/block resources, capabilities, SELinux/AppArmor denial, systemd sandboxing, cgroup limits and boot-time state that differs from the interactive shell.

Evidence references

Evidence · 1 on this Topic

Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.

observation · 1
Drill down

Subtopics

Go one level deeper into this subject.

Key points

Denials are logged as apparmor="DENIED" in the kernel log. Add local rules in /etc/apparmor.d/local/<profile> and reload — do not edit the shipped profile. Use complain mode only to learn rules.

Key checks
  • aa-status — loaded profiles and modes
  • journalctl -k | grep -i apparmor — denials
  • aa-complain / aa-enforce <profile> — change a profile's mode
  • apparmor_parser -r <profile> — reload a profile
ReferenceWhy it matters1 section · depth on demand

How it works in operation

Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.

ReferenceHow it works2 sections · depth on demand

How it works

Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.

Quick reference

AppArmor is the mandatory access control system used by default on Ubuntu, Debian and SUSE. Instead of labelling files, it confines programs with path-based profiles that list which files, capabilities and network access each program may use. Programs without a profile run unconfined.

ConceptMeaning
ProfileRules for one executable, in /etc/apparmor.d/
Enforce modeViolations blocked and logged
Complain modeViolations only logged — used to build profiles
AbstractionsReusable rule sets (#include <abstractions/base>)
Local overrides/etc/apparmor.d/local/ for site additions that survive upgrades
aa-status
journalctl -k | grep -i apparmor          # DENIED messages
aa-complain /etc/apparmor.d/usr.sbin.nginx
aa-enforce /etc/apparmor.d/usr.sbin.nginx
aa-logprof                                 # suggest rules from logs
apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx

When a confined service suddenly cannot read a new directory or bind a socket, check for DENIED entries first. Add the minimal rule in the local/ include file, reload the profile and keep enforce mode rather than disabling AppArmor for the service.

ReferenceImportant terms & boundaries5 sections · depth on demand

What this shows and what it does not

AppArmor is resolved when the target process/profile/mode are confirmed, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement.

Permission denial can arise from path traversal, ACL, capabilities or SELinux/AppArmor independently.

In depth

AppArmor: profiles, modes and tools

AppArmor is the mandatory access control system used by default on Ubuntu, Debian and SUSE. The apparmor(7) manual page describes its design:

  • Access rules are bound to programs, not users.
  • Profiles are stored in /etc/apparmor.d/, named after the program path with dots, for example usr.sbin.nscd for /usr/sbin/nscd. They're loaded into the kernel with apparmor_parser.
  • In enforce mode, rules are enforced and violations are reported. In complain mode, violations are only logged.
  • Denials appear in the audit log, or in syslog without auditd, as apparmor="DENIED".
  • A profile applies when the program is executed, so a process already running unconfined stays unconfined.

AppArmor and SELinux compared

AppArmorSELinux
ModelPath-based profiles per programType labels on all files and processes
Default onUbuntu, Debian, SUSERHEL family, Fedora
Labels stored in file systemsNoYes (extended attributes)
Writing a new policyRelatively simple (profile files)More complex (policy modules)
GranularityPer programSystem-wide types and domains

Tools

TaskCommand
Is it enabled?aa-enabled
Loaded profiles and their modesaa-status
Switch modesaa-enforce <profile>, aa-complain <profile>
Load or reload a profileapparmor_parser -r /etc/apparmor.d/<file>
Unload a profileapparmor_parser -R /etc/apparmor.d/<file>
Disable one profileln -s /etc/apparmor.d/<file> /etc/apparmor.d/disable/ + apparmor_parser -R
Create a profile interactivelyaa-genprof <program>
Update a profile from logsaa-logprof
host$ aa-enabled
Yes
host$ sudo aa-status --summary 2>/dev/null || sudo aa-status | head -4
apparmor module is loaded.
42 profiles are loaded.
38 profiles are in enforce mode.
4 profiles are in complain mode.
host$ ls /etc/apparmor.d/ | head -6
abstractions
disable
local
usr.sbin.named
usr.sbin.nginx
usr.sbin.tcpdump
host$ ps -eo pid,label,comm | grep -E "nginx|named" | head -3
   1203 /usr/sbin/nginx (enforce)     nginx
   1240 /usr/sbin/named (enforce)     named
host$ sudo apparmor_parser -r /etc/apparmor.d/usr.sbin.nginx
host$ sudo journalctl -k -g apparmor --since today | tail -2

Local additions

Packaged profiles usually include a file from /etc/apparmor.d/local/, so administrators can add rules without editing the packaged profile. Updates then keep the local changes. The label column in ps shows each process's profile and mode directly.

Documented example, not captured output.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

How it works at runtime

AppArmor is part of AppArmor. AppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions.

Runtime state ownership and mechanics. Linux security composes authentication (PAM and service mechanisms), identity/credentials, DAC permissions/ACLs, capabilities, LSM policy such as SELinux/AppArmor, audit and service/network policy. These controls are cumulative: passing one layer does not bypass another. SELinux labels/types and AppArmor path/profile rules differ in policy model, while auditd records selected security-relevant events rather than making authorization decisions.

Topic-specific state model. AppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions.

Technical metadata. Linux distribution/kernel + boot/time + user/group/process/service identity + PAM/SSH/DAC/ACL + SELinux/AppArmor mode/context/profile + audit/log correlation + key/certificate/SAN/EKU/chain/trust store/SNI + original workload result.

Interpretation rule. - AppArmor enabled/loaded ≠ the target process is actually confined by the intended profile.

  • A profile path rule ≠ protection if execution path, namespace or transition attaches a different/no profile.

Mechanics

Follow the path in order: identity/group resolution → Unix mode/ACL/capability → mount/sandbox constraint → SELinux/AppArmor policy → credential/TLS trust → protected operation.

Important negative cases include UID/GID mismatch, stale group membership, ACL/mode conflict, missing capability, noexec/readonly mount, SELinux denial, AppArmor denial, expired/untrusted certificate or secret exposure.

Source basisSource attribution states what this section is based on; it is not independent proof that the current environment matches it.

Limits and how it fails

Primary failure point. AppArmor is resolved when the target process/profile/mode are confirmed, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement.

Model. chmod 777 cannot override LSM or read-only mount policy. Disabling SELinux/AppArmor to make an error disappear only localizes a policy boundary and can hide the real label/profile defect. PAM success does not show sudo, filesystem or application authorization. Fail2ban acts on observed authentication patterns and network banning; it does not fix authentication policy. Security controls should remain explicit layers rather than a single “permission denied” bucket.

ReferenceConfiguration & state2 sections · depth on demand

Configuration, persistence and lifecycle

Configuration intent and lifecycle. Harden one control with a known access/recovery path and preserve the policy source of truth. PAM stack order/control flags matter; sudo/SSH hardening can lock out administration; SELinux policy should normally be fixed through correct labels/booleans/policy rather than permanent disablement; AppArmor profiles should move from complain to enforce only after reviewing legitimate workload behavior. Audit rules need bounded scope to avoid volume/resource problems.

Distribution/platform context. AppArmor root owns operational profile/mode diagnosis; Security → AppArmor is the architecture bridge.

Lifecycle

systemd generators and drop-ins, package scripts, udev, mount helpers, netlink, resolver caches, namespaces, SELinux/AppArmor policy and kernel drivers can make runtime state differ from the file or command that appears to own it.

Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Technical verification history

Verification history & basis

When and against what this Topic was checked. Later text edits do not count as a new check.

2026-09-14 · vendor doclinux current

Authoritative/upstream documentation reviewed for bounded claims in AppArmor. Documentation verification only; this is not observed lab or production Evidence.

Basis: https://gitlab.com/apparmor/apparmor/-/wikis/Documentation · confidence 94%
Technical changelog & impact

What changed and what may be affected

Recent technical edits are separated from ordinary page timestamps. Relationship impact is advisory: it identifies nearby canonical references to review, not automatic breakage.

Related reference impactReview these references after material technical changes when their shared boundary is affected.
Terminology layer

Terms & aliases

Hover a linked term for a quick definition; click it to open its glossary entry. Aliases are other names that find this Topic in search.

Aliases that resolve here
AppArmorapparmor lsmapparmor profiles linux
Embedded reference data

Quick lookup tables

AppArmor operational reference

Topic-specific lookup boundaries, proof limits and next-step Evidence for AppArmor.

Lookup boundaryTopic-specific referenceOperational use
Scope / effective stateAppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions.Establish exactly what this Topic owns before crossing into another subsystem.
Fast verificationPin host + boot/time + real identity/workload → identify authoritative policy/key/trust source → read back loaded/effective runtime state → reproduce one safe allow/deny/handshake test → correlate audit/service/kernel evidence → locate first failed boundary → make the smallest persistent change → repeat original workload + regression/recovery check.Use the shortest evidence path first; a fast check is a boundary test, not blanket proof.
Verification chainprogram execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycleTrace requested/configured state through effective state to the observed workload result.
Failure boundaryAppArmor closes when the target process/profile/mode are proven, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement.Stop broad troubleshooting at the first boundary that is not supported by evidence.
Positive evidenceCorrelated Linux security/trust evidence can establish this proof path: program execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycleUse this observation only for the specific claim it actually supports.
Evidence limitIt does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. AppArmor closes when the target process/profile/mode are proven, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement.Do not promote a local success signal into end-to-end or adjacent-dependency proof.
Next troubleshooting checkContinue from the first unproven security/trust boundary, capture the adjacent effective state and audit/handshake evidence, make only the demonstrated persistent change, then repeat the original workload plus recovery/regression checks.Continue to the next unresolved boundary while preserving the original test condition.

AppArmor · operational reference

Compact Linux state, persistence, verification and boundary reference for fast lookup.

Reference boundaryAppArmor
Topic pathAppArmor
Runtime stateAppArmor is the dedicated operational reference for path-oriented mandatory access control using named profiles, execution attachment/transitions and enforce/complain modes alongside ordinary Linux permissions.
Fast checks- Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for AppArmor. - Read back the effective runtime state and precedence rather than assuming an edited file, package state or service status is active. - Reproduce one safe allowed/denied or handshake/access test and correlate kernel/service/audit evidence at the first relevant boundary. - Apply the smallest persistent cause-specific change, then repeat the original test plus an adjacent regression/recovery check.
Verification chainprogram execution/path → profile attachment/transition → DAC/capabilities → AppArmor rule → allow/log/deny → workload → profile lifecycle Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return/regression → explicit Evidence boundary. Boundary chain: local authoritative state → adjacent dependency → effective/programmed state → original workload/request → return path or regression → explicit Evidence boundary.
Failure boundaryAppArmor closes when the target process/profile/mode are proven, minimal profile changes address the demonstrated operation, and the original workload succeeds under intended enforcement. Boundary chain: process credentials/namespace → path/mount lookup → DAC/ACL/LSM → filesystem metadata → block/device/backend → completion/read-back.
Persistence ruleProve which configuration source owns the state, then prove that the running consumer loaded or generated the intended state.
Confirmation

Confirm action

Continue?