Use it to track who changed sensitive files or ran privileged commands, or for compliance.
Auditd
auditd records security-relevant events from the kernel audit system: logins, privilege use, file access watched by rules, and SELinux denials, in /var/log/audit/audit.log.
1. systemctl status auditd.
2. auditctl -l — loaded rules.
3. Watch a file: -w /etc/sudoers -p wa -k sudoers in rules.d; augenrules --load.
4. Search: ausearch -k sudoers -i.
5. Report: aureport --summary.
event in the kernel → audit rule matches → record written by auditd → searched and forwarded
For Security → Auditd, 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 Auditd. 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
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Operational evidence path Verify boundary
security action/syscall/LSM event → kernel audit rule → audit backlog/netlink → auditd → persistence/forwarding → multi-record correlation → investigation conclusion
Healthy evidence: required rules are loaded, backlog/disk health is stable, correlated event records are retained and queries reconstruct the expected allowed/denied test activity
Step 2 Verification and output interpretation Verify boundary
Verification chain. security action/syscall/LSM event → kernel audit rule → audit backlog/netlink → auditd → persistence/forwarding → multi-record correlation → investigation conclusion
Step 3 Commands Verify boundary
auditctl -l
ausearch -k identity -ts today
aureport --summary
Step 4 Failure modes and next checks Narrow the fault
Suspicious evidence: rules are missing/stale, backlog or disk loss occurs, watch paths changed, event records are fragmented, time filters are wrong or audit absence is treated as evidence nothing happened
Step 5 Common mistakes Narrow the fault
- Too broad audit rules filling disk.
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.
Add rules in /etc/audit/rules.d/*.rules and load with augenrules --load. Search with ausearch, summarise with aureport. Forward audit logs off the host. Too many rules cost performance.
auditctl -l— loaded audit rulessestatus / aa-status— SELinux or AppArmor statess -tulpn— listening servicesjournalctl -u sshd -g 'Failed'— failed loginsausearch -m avc,user_login -ts today— audit events (auditd)
ReferenceImportant terms & boundaries5 sections · depth on demand
What this shows and what it does not
Audit evidence shows only the configured/captured scope and retention window; absence of a record is not evidence of absence unless rule coverage, backlog and storage are demonstrated.
In depth
auditd: recording security-relevant events
The Linux audit system records events such as file access, system calls and logins in a tamper-resistant log, /var/log/audit/audit.log. auditctl manages the kernel rules, and the auditctl(8) manual page describes them:
-llists rules, and-sshows the status, including lost events and the backlog.-a always,exit -F arch=b64 -S <syscall>records system calls.archmust come before-S.-w <path> -p rwxa -k <key>watches a path. The manual marks this form deprecated, because of its performance cost, and recommends the syscall form.-ktags rules with a key, whichausearch -kfinds later.-e 2makes the configuration immutable until the next reboot.-Ddeletes all rules.
Rules worth having
| Purpose | Rule (syscall form) |
|---|---|
| Changes to accounts | -a always,exit -F arch=b64 -S openat,open_by_handle_at -F path=/etc/passwd -F perm=wa -k identity (and shadow, group, gshadow) |
| Changes to sudo rules | The same, for /etc/sudoers and the /etc/sudoers.d directory, key privilege |
| Commands run as root by users | -a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root-cmd |
| Kernel module loading | -a always,exit -F arch=b64 -S init_module,finit_module,delete_module -k modules |
| Time changes | -a always,exit -F arch=b64 -S clock_settime,settimeofday,adjtimex -k time-change |
| Lock the rules | -e 2 as the last line |
auid
The audit UID (auid) is set at login, and stays the same through sudo and su. That's why audit logs can show who actually ran a command as root, when the system log only shows "root".
Persistent rules
Rules go in /etc/audit/rules.d/*.rules. augenrules --load merges them into /etc/audit/audit.rules and loads them. With -e 2 set, rule changes need a reboot.
host$ sudo tee /etc/audit/rules.d/50-identity.rules >/dev/null <<'EOF'
-a always,exit -F arch=b64 -S openat,open_by_handle_at -F path=/etc/shadow -F perm=wa -k identity
-a always,exit -F arch=b64 -S openat,open_by_handle_at -F path=/etc/sudoers -F perm=wa -k privilege
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root-cmd
EOF
host$ sudo augenrules --load && sudo auditctl -l | head -3
host$ sudo auditctl -s | grep -E "enabled|lost|backlog "
enabled 1
lost 0
backlog 0
host$ sudo ausearch -k root-cmd -ts today -i | grep -E "type=EXECVE|auid=" | tail -2
type=SYSCALL ... auid=alice uid=root euid=root comm="systemctl" exe="/usr/bin/systemctl" key="root-cmd"
host$ sudo aureport --auth --summary -ts today
Watch the lost counter
lost above 0 in auditctl -s means the kernel dropped audit events, because the backlog filled. Increase the backlog (-b), or reduce noisy rules. For compliance, lost events are themselves a finding.
Documented example, not captured output.
How it works at runtime
Auditd is part of Security → Auditd. Auditd consumes Linux Audit subsystem events and persists/forwards multi-record security events under configured rules, backlog and failure policies for accountable investigation.
Topic-specific state model. Auditd consumes Linux Audit subsystem events and persists/forwards multi-record security events under configured rules, backlog and failure policies for accountable investigation.
Interpretation rule. - auditd running ≠ required kernel audit rules are loaded or retained.
- One audit record ≠ the complete event; related records can share a serial/event identifier.
Quick reference
auditd records security-relevant kernel events according to rules: file access, syscalls, user commands, privilege changes.
# /etc/audit/rules.d/50-local.rules
-w /etc/sudoers -p wa -k sudoers_change
-w /etc/ssh/sshd_config -p wa -k sshd_config
-a always,exit -F arch=b64 -S execve -F euid=0 -F auid>=1000 -F auid!=unset -k root_cmds
augenrules --load
auditctl -l
ausearch -k sudoers_change -i
aureport --summary; aureport -au --failed
auid (login UID) survives sudo, so audit trails show who really ran a command. Ship logs off-host (audisp/rsyslog to SIEM) — local logs can be wiped by an attacker with root.
Limits and how it fails
Primary failure point. Audit evidence shows only the configured/captured scope and retention window; absence of a record is not evidence of absence unless rule coverage, backlog and storage are demonstrated.
ReferenceConfiguration & state1 section · depth on demand
Configuration, persistence and lifecycle
Distribution/platform context. Auditd owns Linux Audit collection; Logging owns broader log transport/retention and Security incident branches own interpretation.
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Security → Auditd. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://docs.kernel.org/security/index.html · confidence 94%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.
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.
Quick lookup tables
Auditd operational reference
Topic-specific lookup boundaries, proof limits and next-step Evidence for Auditd.
| Lookup boundary | Topic-specific reference | Operational use |
|---|---|---|
| Scope / effective state | Auditd consumes Linux Audit subsystem events and persists/forwards multi-record security events under configured rules, backlog and failure policies for accountable investigation. | Establish exactly what this Topic owns before crossing into another subsystem. |
| Fast verification | Pin 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 chain | security action/syscall/LSM event → kernel audit rule → audit backlog/netlink → auditd → persistence/forwarding → multi-record correlation → investigation conclusion | Trace requested/configured state through effective state to the observed workload result. |
| Failure boundary | Audit evidence proves only the configured/captured scope and retention window; absence of a record is not proof of absence unless rule coverage, backlog and storage are demonstrated. | Stop broad troubleshooting at the first boundary that is not supported by evidence. |
| Positive evidence | Correlated Linux security/trust evidence can establish this proof path: security action/syscall/LSM event → kernel audit rule → audit backlog/netlink → auditd → persistence/forwarding → multi-record correlation → investigation conclusion | Use this observation only for the specific claim it actually supports. |
| Evidence limit | It does not independently prove unobserved identities, objects, policies, namespaces, endpoints or time periods. Audit evidence proves only the configured/captured scope and retention window; absence of a record is not proof of absence unless rule coverage, backlog and storage are demonstrated. | Do not promote a local success signal into end-to-end or adjacent-dependency proof. |
| Next troubleshooting check | Continue 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. |
Auditd · operational reference
Compact Linux state, persistence, verification and boundary reference for fast lookup.
| Reference boundary | Auditd |
|---|---|
| Topic path | Security → Auditd |
| Runtime state | Auditd consumes Linux Audit subsystem events and persists/forwards multi-record security events under configured rules, backlog and failure policies for accountable investigation. |
| Fast checks | - Record exact host, distribution/kernel, boot ID, time window, workload, identity and the authoritative configuration/policy source for Auditd. - 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 chain | security action/syscall/LSM event → kernel audit rule → audit backlog/netlink → auditd → persistence/forwarding → multi-record correlation → investigation conclusion 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 boundary | Audit evidence proves only the configured/captured scope and retention window; absence of a record is not proof of absence unless rule coverage, backlog and storage are demonstrated. Boundary chain: process/context → userspace configuration → kernel subsystem/resource → device/network/filesystem dependency → effective state → original workload. |
| Persistence rule | Prove which configuration source owns the state, then prove that the running consumer loaded or generated the intended state. |