Excalibur's Sheath

File Auditing and Security Tools

Apr 22, 2025 • By Jordan McGilvraylinux,security,file-auditing,system-integrity,auditd,aide,chkrootkit,rkhunter,rootkit-detection,sysadmin

Linux system administration requires more than just user permissions and firewall configurations to ensure true security. Even with strong setups, a compromised system can go unnoticed without proper visibility. File auditing and integrity monitoring tools track unauthorized changes and detect intrusions early — before they cause significant damage.

This article explores several tools — including auditd, AIDE, chkrootkit, and rkhunter — that help safeguard your system from tampering. These tools are essential for detecting unauthorized changes, ensuring system integrity, and monitoring for rootkits. Whether managing production servers or personal systems, they form a critical part of your Linux security toolkit.


File Access and Event Auditing: auditd

In environments that require detailed audit logs, auditd is essential. It allows you to track sensitive operations and file access, making it ideal for regulated industries or systems where compliance is a concern. It’s useful for administrators who need to monitor every access to critical files or changes to system settings.

Installation

# Debian/Ubuntu
sudo apt install auditd

# RHEL/CentOS
sudo dnf install audit

Example: Monitor /etc/passwd

sudo auditctl -w /etc/passwd -p wa -k passwd_changes

To view matching events:

sudo ausearch -k passwd_changes

Make rules persistent by adding them to /etc/audit/rules.d/audit.rules.


File Integrity Monitoring: AIDE and tripwire

For systems that don’t change frequently, file integrity monitoring tools like AIDE and Tripwire are invaluable. They create baselines of system files and alert administrators to any unauthorized changes, making them especially useful for production servers or hardened systems.

AIDE (Advanced Intrusion Detection Environment)

AIDE compares your system’s files against a snapshot, alerting you to unauthorized changes.

Installation

# Debian/Ubuntu
sudo apt install aide

# RHEL/CentOS
sudo dnf install aide

Initialize and Run

sudo aideinit
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz
sudo aide --check

Schedule regular checks using cron or systemd timers.

Tripwire

Like AIDE, Tripwire monitors file integrity but is typically more complex to configure, offering additional features for enterprise-level systems.

# Debian/Ubuntu
sudo apt install tripwire

After installation, configure policies and initialize the database for file integrity monitoring.


Rootkit Detection: chkrootkit and rkhunter

Rootkits can hide malicious activity from traditional security tools. Tools like chkrootkit and rkhunter scan for signs of rootkits and other hidden threats, making them essential for systems exposed to public networks or high-risk environments.

chkrootkit

A lightweight tool for detecting known rootkits and suspicious system behavior.

Installation & Usage

sudo apt install chkrootkit
sudo chkrootkit

Review the output for potential compromises.

rkhunter (Rootkit Hunter)

A more comprehensive tool, rkhunter checks for rootkit signatures, hidden files, and suspicious activity.

Installation

sudo apt install rkhunter

Usage

sudo rkhunter --update
sudo rkhunter --check

Review logs at /var/log/rkhunter.log.


Bonus Security Tools

lynis

For a broad security audit, lynis is an excellent choice. It checks for configuration weaknesses and security gaps across your system.

sudo apt install lynis
sudo lynis audit system

fail2ban

fail2ban helps prevent brute-force attacks by scanning log files for failed login attempts and blocking offending IPs.

sudo apt install fail2ban

Best Practices

  • Keep integrity databases and rootkit signatures up to date.
  • Automate regular scans using cron jobs or timers.
  • Continuously review audit logs and alerts.
  • Use a combination of tools for layered security.
  • Test configurations and updates in a staging environment before deploying to production.

Combining auditing, integrity monitoring, and rootkit detection creates a robust defense against unauthorized changes and malware. By using these tools together, you can detect and respond to intrusions quickly — before they cause serious damage.

For further details on system security and monitoring, you might find our guide on Mastering Network Tools useful. Additionally, understanding the importance of DNS configuration and security practices in email servers can help build a more secure infrastructure; check out our article on DNS Records That Help Secure an Email Server.