Managing File Integrity with AIDE (Tripwire-Style)
Deploy AIDE to hash and snapshot critical files, detect tampering, and answer "was this file changed against policy" with a defensible audit trail.
Netbay Engineering
Netbay Engineering
On this page
When an attacker replaces a binary or a rootkit alters a system library, the filesystem itself becomes part of the lie. AIDE — the Advanced Intrusion Detection Environment — guards against this by building a cryptographic snapshot of critical files and detecting any drift away from it. It is the open-source descendant of the classic Tripwire approach: baseline once, then periodically verify that the files you care about are byte-for-byte what they should be. This guide covers installing AIDE on a Linux VPS, taking a trustworthy baseline, tuning the rule set, and reading the results.
Why File Integrity Checking Matters
Files are the software the box runs. If a rootkit replaces su or a web shell inserts itself into a script, the system's behavior and its honest appearance split — everything looks normal while actually compromised. File integrity tools make that split visible: they fingerprint critical files when the system is known good, then periodically re-fingerprint and flag the difference. The discipline is the same tradeoff as the inventory of a warehouse: you can know nothing until you record what should be there, and you cannot trust a recorded baseline that was taken after the compromise.
Install and Take a Trustworthy Baseline
Install AIDE and initialize its database on a system you believe is clean — ideally right after a fresh deploy and full patch, before the box faces untrusted traffic. The baseline is a snapshot of file attributes and hashes, and its value is exactly proportional to how trustworthy that starting point is. A compromised baseline means AIDE happily certifies the infection as normal.
sudo apt install -y aide
sudo aideinit
sudo mv /var/lib/aide/aide.db.new /var/lib/aide/aide.dbaideinit computes the initial database into aide.db.new, and the mv promotes it to the active aide.db. Because the database is the reference, an attacker who can modify it can rewrite history, so guard its location and treat its mode like a private key. On newer systems the standard paths are /var/lib/aide/aide.db for the database and /var/lib/aide/aide.db.wk for the work copy used during updates.
Tune the Rule Set to What Actually Matters
AIDE's default config tries to cover a lot, which can produce a baseline that is noisy to maintain. The configuration file defines rule groups by directory and file path, and the skill is scoping it to the files whose change genuinely concerns you: system binaries, boot files, configuration, and directories where no legitimate change should happen. Explicitly excluding high-churn paths keeps real findings visible instead of burying them.
sudo grep -E "^(/bin|/usr/bin|/etc|/boot)" /etc/aide/aide.conf
sudo nano /etc/aide/aide.confThe classic pitfall is a rule that watches /var or other high-turnover directories, generating change reports for log rotation and cached files that are obviously benign. Narrow the watch to pristine system paths — /bin, /usr/bin, /sbin, /etc, /boot — where any change is meaningful, and wrap the database and config themselves so tampering with the tool is itself detected.
Run Checks and Read the Report
Once the baseline exists, a check is a single command that recomputes hashes, compares against the database, and prints every difference — changed, added, or removed. The output names each file and what changed about it, which is exactly the detail you need to decide whether a change is an authorized update or a red flag.
sudo aide --check
sudo grep -c "changed:" /var/log/aide.logA clean check ends with a count of zero changed files and a reassuring "database ... does not match" being absent. When changes appear, the report tells you file by file: a package update legitimately replaced /usr/bin/curl, while a changed /etc/.hidden_marker deserves immediate investigation. The streak of clean checks is itself the evidence you use to notice the one that is not.
Distinguish Legitimate Change From Finding
The hard part of integrity monitoring is not the check — it is judging the result. Package updates and legitimate configuration edits change files every time, so a change to a watched binary after an apt or dnf run is expected. The discipline is: expect and approve the authorized changes, and treat anything else as a potential finding. The way to make this tractable is to correlate changes with deployments — run a check before and after an update so the diff is attributable to the maintenance event, not a mystery.
sudo aide --before && sudo apt upgrade -y && sudo aide --afterComparing the before and after reports around a known maintenance action attributes every change to the event. When a check turns up a change with no corresponding deploy or patch, that is the signal to investigate immediately — a file that changed when nothing should have touched it is the very sign integrity checking exists to surface.
Make Integrity Verification a Scheduled Habit
A single baseline check is a snapshot, not a practice. Schedule AIDE to run on a timer and store its report where you will actually read it, or alert on any non-zero result. The pattern mirrors the other maintenance loops in this series: automated, scheduled, notified, and therefore actually executed.
sudo crontab -e
0 2 * * 0 /usr/bin/aide --check >> /var/log/aide.log 2>&1A weekly run with log output gives you a repeatable "everything is as it should be" cadence, and any deviation is caught within the week. Adopt the habit of skimming that weekly report the way you skim the accepted-login tail, and integrity drift becomes a discovery event instead of a retrofit after the fact.
Takeaway
AIDE gives a Linux server an honest memory of what its files should be: baseline once on a clean system, scope the watch to the files that matter, and compare on a schedule so tampering surfaces while it is still cheap to answer. A Netbay Ubuntu or Rocky VPS boots a fresh, patchable image ideal for taking a trustworthy AIDE baseline before your workload ever touches the internet — netbayhosts.in.
Keep reading
Follow along on a real VPS
Deploy Linux in under 60 seconds
These guides are written against Ubuntu, Debian, and RHEL-family images — the same ones on NetBay.
Deploy an instance