Why
Rootkits are malicious software that give attackers privileged access to your system while hiding their presence. Rkhunter (Rootkit Hunter) scans for known rootkits, backdoors, and security exploits on your Linux system.How It Works
Rkhunter performs various security checks including:- Scanning for known rootkit files and directories
- Checking for suspicious strings in kernel modules
- Verifying file integrity of system commands
- Detecting hidden files and processes
- Checking for suspicious network activity
Goals
- Rkhunter installed and configured to scan for rootkits daily
- Automatic email notifications when threats are detected
References
- http://rkhunter.sourceforge.net/
- https://www.cyberciti.biz/faq/howto-check-linux-rootkist-with-detectors-software/
- https://www.tecmint.com/install-rootkit-hunter-scan-for-rootkits-backdoors-in-linux/
Installation and Setup
Create a local configuration file
Instead of modifying the main configuration file
/etc/rkhunter.conf, create and use /etc/rkhunter.conf.local:Using a
.local configuration file prevents your changes from being overwritten during updates.Configure rkhunter
Edit
/etc/rkhunter.conf.local with these recommended settings:| Setting | Value | Note |
|---|---|---|
UPDATE_MIRRORS | 1 | Enable mirror updates |
MIRRORS_MODE | 0 | Use mirrors for updates |
MAIL-ON-WARNING | root | Email warnings to root |
COPY_LOG_ON_ERROR | 1 | Save log copy on errors |
PKGMGR | (varies) | Set to your package manager (e.g., DPKG for Debian) |
PHALANX2_DIRTEST | 1 | Enable additional directory tests |
WEB_CMD | "" | Disable web-based updates (Debian package issue workaround) |
USE_LOCKING | 1 | Prevent multiple simultaneous runs |
SHOW_SUMMARY_WARNINGS_NUMBER | 1 | Show count of warnings found |
Setting
WEB_CMD="" addresses an issue with the Debian package that disables rkhunter’s self-update ability.Enable daily scans
On Debian based systems, enable the daily cron jobs. Check Answer
/etc/default/rkhunter or use:Yes to all questions to enable daily scans and email reports.Validate configuration
Verify all settings are valid:This checks for configuration errors before running scans.