How to Detect Unauthorized File Changes with AIDE Integrity Monitoring

AIDE (Advanced Intrusion Detection Environment) creates a baseline snapshot of your file system and alerts you to unauthorized changes — a valuable early-warning system for detecting compromise or unintended modification.

What File Integrity Monitoring Detects

Any unexpected modification to files you're monitoring — a modified system binary, an added backdoor script, or unauthorized configuration changes — often among the earliest detectable signs of a compromise, before more obvious symptoms appear.

Step 1 — Install AIDE

sudo apt install aide aide-common -y

Step 2 — Review the Default Configuration

cat /etc/aide/aide.conf

Defines which directories/files are monitored and what attributes (permissions, size, checksums) are tracked for each.

Step 3 — Customize Monitoring Rules (Optional)

sudo nano /etc/aide/aide.conf.d/99_custom
/var/www/myapp NORMAL

Add specific paths relevant to your setup beyond the default system-focused monitoring, such as your application's code directory.

Step 4 — Initialize the Baseline Database

sudo aideinit

Creates the initial snapshot that future checks compare against — run this on a known-clean system, ideally right after initial hardening, before any potential compromise could occur.

Step 5 — Activate the Database

sudo cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db

Step 6 — Run a Manual Check

sudo aide --check

Compares the current file system state against the baseline, reporting any additions, deletions, or modifications.

Step 7 — Schedule Regular Automated Checks

sudo crontab -e
0 3 * * * /usr/bin/aide --check | mail -s "AIDE Report: $(hostname)" [email protected]

Interpreting AIDE Reports

Each report lists added, removed, and changed files — review these carefully; some changes are entirely expected (log files, package updates), while unexpected changes to system binaries or configuration warrant immediate investigation.

Updating the Baseline After Legitimate Changes

sudo aideinit
sudo cp /var/lib/aide/aide.db.new /var/lib/aide/aide.db

After legitimate system changes (package updates, intentional configuration changes), update the baseline so future reports don't repeatedly flag the same expected changes.

Reducing Noise: Excluding Frequently-Changing Paths

!/var/log
!/tmp

Exclude directories that legitimately change constantly and aren't security-critical to monitor at the file-integrity level, reducing report noise and making genuine anomalies easier to spot.

Protecting the AIDE Database Itself

If an attacker can modify the AIDE database itself, they could hide their changes from detection — consider storing the baseline database on read-only or separate storage, or at minimum restrict its permissions tightly.

Common Errors

Reports flood with expected changes — refine your monitored paths and exclusions to focus on genuinely security-relevant files (system binaries, configuration) rather than routinely-changing application data.

Continue Reading

Browse more articles in Server Security & Hardening.

  • aide file integrity monitoring, detect unauthorized file changes, aide linux setup, intrusion detection file integrity
  • 0 کاربر این را مفید یافتند
آیا این پاسخ به شما کمک کرد؟

مقالات مربوطه

SSH Hardening: Change the Port, Disable Root Login & Use SSH Keys (Ubuntu & Debian)

SSH is the front door to your VPS — and by default it listens on a well-known port, often...

How to Install and Configure Fail2Ban on Ubuntu & Debian (Complete Guide)

Fail2Ban monitors your server's log files and automatically blocks (bans) IP addresses that show...

How to Configure UFW Firewall on a Linux VPS (Ubuntu & Debian)

UFW (Uncomplicated Firewall) is the standard firewall front-end on Ubuntu and Debian. A correctly...

How to Enable Two-Factor Authentication (2FA) for SSH on a Linux VPS

Two-Factor Authentication (2FA) adds a second layer of protection to SSH: even if your password...

VPS Security Checklist for Beginners: 12 Essential Steps

Every new VPS is deployed with default settings that are convenient but not secure. This...