AIDE on Linux: file integrity monitoring that holds up
Set up AIDE on Debian 13, Ubuntu 24.04 and RHEL: build a baseline, prove it catches a planted change, run it daily, cut the noise, and keep the database out of an intruder’s reach.
AIDE (Advanced Intrusion Detection Environment) records the permissions, owner, size, timestamps and checksums of the files you tell it to watch, and stores them in a database. Each later check walks the same files and lists what was added, removed or changed. If someone swaps a binary in /usr/bin, drops a job into /etc/cron.d or edits sudoers, the next check names the file.
It doesn’t run continuously and it doesn’t record who made a change: it compares two snapshots. For the who and when, pair it with auditd. This guide covers the setup on Debian 13, Ubuntu 24.04 and RHEL, a test that proves it works, and the parts most guides skip: noise, the database itself, and two detection bypasses fixed in October 2026. auditd guide →
What differs between distributions
| Debian 13 | Ubuntu 24.04 | RHEL 9 | |
|---|---|---|---|
| AIDE version | 0.19.1 | 0.18.6 | 0.16 |
| Config | /etc/aide/aide.conf + aide.conf.d/ | /etc/aide/aide.conf + aide.conf.d/ | /etc/aide.conf |
| Database | /var/lib/aide/aide.db | /var/lib/aide/aide.db | /var/lib/aide/aide.db.gz |
| Daily check | dailyaidecheck.timer, shipped | dailyaidecheck.timer, shipped | None; you add it |
Debian and Ubuntu add a layer of scripts around AIDE (aideinit, the daily timer, settings in /etc/default/aide). Their aide binary has no default config file, so when you run it by hand you always pass --config /etc/aide/aide.conf. On RHEL you run aide directly. Debian README ↗ Red Hat: Checking integrity with AIDE ↗
AIDE 0.19 changed the config language, which matters if you carry an old aide.conf to Debian 13. The database option is gone (use database_in), and an unrestricted ! rule no longer skips everything under a matching directory. More on that below. AIDE NEWS ↗
Patch AIDE first
On 22 October 2026 the AIDE project published two advisories, both described as detection bypasses: one in how hash values containing a null byte were compared, one in how file names with invalid UTF-8 were handled. They affect versions up to 0.19.4 and are fixed in 0.19.5. Debian fixed Debian 13 in 0.19.1-2+deb13u5 (DSA-6578-1). The UTF-8 issue goes back to 0.16, so on Ubuntu and RHEL check your vendor’s security tracker before you rely on the reports. AIDE advisories ↗ DSA-6578-1 ↗
dpkg-query -W aide # Debian, Ubuntu
rpm -q aide # RHELInstall it and build the baseline
Build the baseline when the server is in the state you mean it to be in: after setup and hardening, before it takes traffic. Otherwise the first report is a list of your own changes.
# Debian, Ubuntu
sudo apt install aide
sudo aideinit
# RHEL
sudo dnf install aide
sudo aide --init
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gzBoth take a few minutes because AIDE reads and hashes every file it watches. aideinit writes /var/lib/aide/aide.db.new and then asks whether to replace aide.db with it. aideinit -y -f answers yes to both questions, which is fine on a new server and throws away your current baseline on an old one. aideinit(8) ↗
Prove it catches a change
Don’t trust a monitor you haven’t seen fire. Plant a harmless file where attackers like to persist, run a check limited to that directory, then clean up. On Debian and Ubuntu, first confirm the path is covered by a rule:
sudo aide --config /etc/aide/aide.conf --path-check=f:/etc/cron.d/aide-canary; echo $?
# 0 = the file would be in the database, 1 = no rule covers itecho "# aide canary, safe to delete" | sudo tee /etc/cron.d/aide-canary
sudo aide --config /etc/aide/aide.conf --check --limit /etc/cron.d; echo $?
sudo rm /etc/cron.d/aide-canaryOn RHEL drop the --config part. --path-check needs AIDE 0.17 or later, so skip it on RHEL 9. The report should list the canary under added entries, and the exit code should be 1.
That exit code is useful for automation. After a check, AIDE adds 1 if files were added, 2 if files were removed and 4 if files changed, so 5 means added and changed. Values of 14 and above are errors: 17 is a configuration error, 18 an I/O error and 24 a database error. A monitoring check can alert on anything other than 0. aide(1) ↗
Run it every day, and make sure someone reads it
On Debian and Ubuntu the package ships dailyaidecheck.timer. It fires at 01:50 with a random delay of up to two hours. The report goes to /var/log/aide/aide.log and errors to /var/log/aide/error.log.
systemctl list-timers dailyaidecheck.timer
sudo systemctl start dailyaidecheck.service # run it now (allowed once per two hours)
journalctl -u dailyaidecheck.service -n 30Don’t count on mail. The daily job runs as an unprivileged _aide user, and under systemd it can only send mail if s-nail is installed and a mail server is listening on localhost. Without both, it writes a warning to the journal and the report to the log file, and nobody hears about it. Either set that up and set MAILTO in /etc/default/aide, or ship /var/log/aide/aide.log with your other logs.
Red Hat recommends checking daily, and weekly at minimum. Its documentation uses a line in /etc/crontab, which mails the output to root through cron:
05 4 * * * root /usr/sbin/aide --checkAccept planned changes without hiding unplanned ones
Every package update changes files, and AIDE will report them until you update the baseline. On Debian and Ubuntu the daily job runs aide --update, which compares against aide.db and writes a fresh aide.db.new, but by default (COPYNEWDB=no) it never promotes that file. Changes keep being reported until you accept them. Leave that default alone: COPYNEWDB=yes accepts every change automatically, including an intruder’s, after it has been reported once.
After patching, read the report and match the changed files against what the package manager did (/var/log/apt/history.log, or dnf history info last). For files that belong to packages, a second opinion is cheap:
sudo dpkg --verify # Debian, Ubuntu: lists files that no longer match their package
sudo rpm -Va # RHELBoth rely on package metadata stored on the same server, so treat them as a cross-check, not proof. When everything is explained, accept it:
# Debian, Ubuntu
sudo aide --config /etc/aide/aide.conf --update
sudo cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db
# RHEL
sudo aide --update
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gzAccept right after the maintenance you did. The longer the gap, the more room for an unplanned change to be accepted along with the planned ones. To accept changes in one area only, add --limit /etc or another path.
Cut the noise with rules
Debian’s shipped rules are, in the package’s own words, “very paranoid”. On a server that runs an application you will want to exclude the parts that change by design and watch your own code properly. On Debian and Ubuntu put your rules in a new file in /etc/aide/aide.conf.d/. The file name may only contain letters, digits, underscores and hyphens: a file called local.conf is silently ignored because of the dot. On RHEL, edit /etc/aide.conf.
# /etc/aide/aide.conf.d/90_aide_local
# deployed code: full check of regular files
/srv/myapp/releases f R
# container state changes all the time; leave it to other tools
-/var/lib/docker$
-/var/lib/containerd$The leading - is a non-recursive exclude, new in 0.19: AIDE skips the directory and never looks inside it. It’s where the 0.19 change bites. In 0.18, !/var/lib/docker$ excluded the directory and everything under it. In 0.19 the same line excludes only the directory itself, then descends into it and adds every child that another rule covers, which can mean all of Docker’s image layers. On Ubuntu 24.04 (0.18) and RHEL, which don’t have the - rule, use ! as before. aide.conf(5) ↗
Check the config and test the rules before the next daily run:
sudo aide --config /etc/aide/aide.conf --config-check
sudo aide --config /etc/aide/aide.conf --path-check=d:/var/lib/docker; echo $? # want 1
sudo aide --config /etc/aide/aide.conf --path-check=f:/srv/myapp/releases/app.py; echo $? # want 0Then rebuild the baseline with aide --update and accept it, or the next report will list every file your rule change added or dropped.
Keep the database out of reach
The AIDE manual says it plainly: like any other system file, AIDE’s binary and database can be altered. An intruder with root can run aide --update to bless their own changes, or add an exclude rule for their directory. Red Hat’s advice is to keep the database, the configuration and the aide binary somewhere secure, such as read-only media. On a rented server, these steps get you most of the way: AIDE manual ↗
- After every accepted update, copy aide.db and the config to another machine, and let that machine pull them so the server holds no credentials for it.
- Record sha256sum /var/lib/aide/aide.db off the server. Before trusting a clean report, check that the hash still matches.
- Send the reports off the server as they’re written, so a quiet report can’t simply be deleted or edited.
- Treat silence as a finding: a server whose daily report stops arriving needs a look.
If you manage RHEL with Ansible, Red Hat’s aide system role can initialize the database on each host and store it on the control node, which covers the first point for you.
AIDE and SOC 2
SOC 2’s criterion CC7.1 expects detection and monitoring procedures that identify configuration changes that introduce new vulnerabilities. One of its points of focus is a change-detection mechanism, and the example the criteria give is file integrity monitoring that alerts staff to unauthorized changes to critical system, configuration or content files. AIDE produces that evidence. The questions an auditor usually adds are who reads the reports, and how accepted changes are tied to approved work. AICPA Trust Services Criteria ↗
That reading and tying-together is the part AIDE leaves to you, once a day and once per server. Vigilhold, our host agent for Linux servers, watches process, network, file and SSH signals on every server and shows them in one console, and its Business plan’s compliance reports give your auditor evidence for SOC 2. They are not a certification. What a HIDS does → See Vigilhold →
The short version
| Step | Check it worked |
|---|---|
| AIDE patched | Your version includes the October 2026 fixes (Debian 13: 0.19.1-2+deb13u5 or later) |
| Baseline built | /var/lib/aide/aide.db (or aide.db.gz) exists, dated after setup |
| It catches changes | The cron.d canary shows up as added, exit code 1 |
| Runs daily | systemctl list-timers dailyaidecheck.timer, or the cron line, shows a next run |
| Someone reads it | The report arrives by mail or in your central logs |
| Noise under control | --path-check gives the answers you expect for excluded and watched paths |
| Baseline protected | An off-server copy and hash match the database on the server |