On the lab machine the auditd service is off: sudo systemctl enable
--now auditd. The rule -w /etc/demo.conf -p wa -k democonf caught a
write to the file from a cron job of the user deploy. One event is
several records with a common number; the main ones are PROCTITLE and
SYSCALL:
student@ubuntu:~$ sudo ausearch -k democonf -i \
> | grep -E '^type=(SYSCALL|PROCTITLE)'
type=PROCTITLE msg=audit(10/21/26 05:49:01.453:288) :
proctitle=/bin/sh /usr/local/bin/tweak.sh
type=SYSCALL msg=audit(10/21/26 05:49:01.453:288) : arch=x86_64
syscall=openat success=yes exit=3 … auid=deploy uid=deploy gid=deploy
euid=deploy … tty=(none) ses=4 comm=tweak.sh exe=/usr/bin/dash
subj=unconfined key=democonf
| Field |
Meaning |
auid |
who logged in — it does not change after sudo or su |
uid, euid |
which user the process ran as at that moment |
comm |
the process name (15 characters) |
exe |
the executable; for a script it is the interpreter, dash here |
proctitle |
the whole command line — for a script it holds the script's path |
tty, ses |
the terminal and login session number; cron has no terminal |
key |
the rule key from -k |
The auid of a cron job is the crontab owner: cron opens a session for
them through PAM (pam_loginuid). A write through sudo sh -c 'echo … >>
/etc/demo.conf' gives uid=root, while auid is the user who logged
in; processes without a login (services, commands through the guest
agent) have auid=unset. The per-file summary is aureport -f -i:
# date time file syscall success exe auid event
1. 10/21/26 05:48:29 /etc/ openat yes /usr/bin/dash unset 279
2. 10/21/26 05:49:01 /etc/ openat yes /usr/bin/dash deploy 288
echo '-w /etc/demo.conf -p wa -k democonf' \
| sudo tee /etc/audit/rules.d/demo.rules
sudo augenrules --load
sudo auditctl -l
augenrules builds /etc/audit/audit.rules from all the
rules.d/*.rules files and loads it into the kernel; auditd does the
same at start. A rule written straight into audit.rules is gone after
the next augenrules --load: the file is rebuilt, and auditctl -l does
not list the rule. Only root can read audit.rules. augenrules --load
prints the subsystem state (enabled 1, backlog …) — that is not an
error.