A security-focused guide to rkhunter — covering installation, running rootkit scans, distinguishing false positives from genuine indicators, configuring automated daily scans, and interpreting warnings during incident response.
What is rkhunter?
rkhunter (Rootkit Hunter) is an open-source host-based rootkit detection tool for Linux. It works by scanning for known rootkit signatures, suspicious file attributes, hidden files and processes, network backdoors, SUID/SGID files outside expected locations, and deviations from expected system binary hashes. Unlike antivirus software, rkhunter focuses specifically on rootkits — malicious software that hides its presence by modifying system binaries, kernel modules, or process tables. It compares system binary hashes against a stored baseline and checks system utilities for known rootkit-specific behaviors. rkhunter generates warnings that must be evaluated by a knowledgeable analyst — the ability to distinguish genuine findings from false positives is the core operational skill.
Syntax
rkhunter --check
rkhunter --check --sk # Skip user interaction
rkhunter --update # Update rootkit signatures
rkhunter --propupd # Update file property database
rkhunter --check --rwo # Report warnings only
rkhunter --check 2>&1 | tee /var/log/rkhunter_$(date +%Y%m%d).log--check runs a full scan. --sk (skip keypress) enables non-interactive execution for automated runs. --update downloads the latest rootkit signature database. --propupd updates rkhunter’s file property database (run this after legitimate package updates to prevent false positives). --rwo reduces output to warnings only — the most useful mode for routine monitoring.
Key Options and Flags
| Flag / Parameter | Description | Security Note |
|---|---|---|
--check | Run a complete rootkit scan of the system | — |
--sk (--skip-keypress) | Skip the 'Press enter to continue' prompts — required for cron/automated runs | — |
--update | Download latest rootkit signatures — run before every scan in production | — |
--propupd | Update file property baseline after legitimate package updates | Run after apt upgrade or yum update to prevent false positives on updated binaries |
--rwo | Report warnings only — suppresses OK messages | Use for daily automated reports — a report with no output means no warnings |
--report-warnings-only | Long form of –rwo | — |
Common Use Cases
Run a Full Rootkit Scan and Review Warnings
The primary use case: run a scan after suspecting compromise, after a security incident, or as part of routine monitoring. Review every WARNING in the output — most will be false positives on a clean system, but each must be evaluated individually. A warning on a critical system binary that cannot be explained by a recent package update is a high-priority investigation item.
rkhunter --update
rkhunter --check --sk --rwo 2>&1 | tee /var/log/rkhunter_$(date +%Y%m%d).log
cat /var/log/rkhunter_$(date +%Y%m%d).logConfigure Automated Daily Scans with Email Alerting
rkhunter is most valuable as a continuous monitoring tool, not a one-time scan. A daily cron job that runs the scan, updates signatures, and emails any warnings provides automated detection of newly installed rootkits or suspicious system changes.
# /etc/cron.daily/rkhunter-scan
#!/bin/bash
/usr/bin/rkhunter --update --nocolors --sk 2>&1 > /dev/null
RESULT=$(/usr/bin/rkhunter --check --nocolors --sk --rwo 2>&1)
if [ -n "$RESULT" ]; then
echo "$RESULT" | mail -s "rkhunter WARNING on $(hostname)" admin@example.com
fiUpdate File Property Database After Package Updates
Every time you update packages with apt or yum, the binary hashes change. Without updating rkhunter’s property database, the next scan will generate false positive warnings for every updated binary. Always run rkhunter --propupd after package updates to keep the baseline current.
apt upgrade -y && rkhunter --propupd
# or
yum update -y && rkhunter --propupd
# Verify the property database was updated
rkhunter --list props | head -20Security Relevance: Distinguishing False Positives from Real Indicators
rkhunter generates warnings for a wide range of conditions, most of which are false positives on a standard Linux server. The operational skill is evaluating each warning in its context rather than treating every finding as an incident. Common false positives include: updated binaries not yet reflected in the property database (fix: run rkhunter --propupd after package updates); custom configurations that match patterns in rkhunter’s heuristic checks (fix: whitelist the specific item in rkhunter.conf); third-party software installed outside the package manager with non-standard file attributes. Genuine indicators of compromise include: warnings on critical binaries like /bin/bash, /bin/login, or /usr/sbin/sshd that do not correspond to a recent package update; hidden files in system directories not created by any known package; network backdoors on unusual ports; SUID binaries in non-standard paths. Cross-validate any suspicious finding with debsums (Debian) or rpm -V (RHEL) and sha256sum against the package manager’s own hash database.
- rkhunter running on a compromised system cannot be trusted — rootkits can patch rkhunter itself to suppress detections
- Always run –propupd after package updates — failing to do so generates false positives that desensitize you to real warnings
- rkhunter warnings alone are not confirmation of compromise — each requires manual verification before taking action
- An rkhunter scan can take 5-15 minutes on a busy server — schedule during off-peak hours
- The rkhunter signature database must be updated regularly — a stale database will miss recently discovered rootkits
Practical Examples
Full scan with output analysis and false positive identification
# Update signatures
rkhunter --update
# Run full scan, capture output
rkhunter --check --sk 2>&1 | tee /tmp/rkhunter_full.log
# Extract only warnings
grep -A 2 'Warning:' /tmp/rkhunter_full.log
# For each warning, cross-validate with package manager
debsums $(dpkg -S /path/to/warned/file 2>/dev/null | cut -d: -f1) 2>/dev/nullThe complete analysis workflow: run scan with full output capture, extract warnings, and cross-validate each warned file against the package manager. If debsums (or rpm -V) reports the file as unmodified, the rkhunter warning is a false positive from a configuration anomaly. If debsums also reports a failure, the file has been modified outside the package manager — a critical finding.
Whitelist a known false positive in rkhunter.conf
# View the current warning
rkhunter --check --sk --rwo 2>&1 | grep 'Warning'
# Add to whitelist in /etc/rkhunter.conf
# For a binary false positive:
grep SCRIPTWHITELIST /etc/rkhunter.conf
# Add: SCRIPTWHITELIST=/path/to/false/positive
# For a property database warning:
rkhunter --propupd FILE=/path/to/fileWhitelisting persistent false positives reduces noise and ensures genuine warnings stand out. Document every whitelist entry with a justification comment in rkhunter.conf. Review whitelisted items periodically — a legitimate file that has been compromised since whitelisting will continue to be suppressed.
Check rkhunter log for historical warnings
cat /var/log/rkhunter.log | grep -E '(Warning|\[ Rootkit |Hidden)'
grep -c 'Warning' /var/log/rkhunter.log
tail -100 /var/log/rkhunter.log | grep WarningThe rkhunter log accumulates across multiple runs. Reviewing the historical log reveals whether a warning is new (sudden appearance after a period of clean scans is more suspicious) or persistent (likely a known false positive). A spike in warning count should trigger immediate investigation.
Troubleshooting Common Issues
Problem: rkhunter generates dozens of warnings after a system update
Solution: Run rkhunter --propupd to update the file property database to reflect the updated binaries. This is the most common cause of mass false positives after apt upgrade or yum update. Always include –propupd in your post-update runbook.
Problem: rkhunter reports 'unable to find the command' for expected tools
Solution: Some rkhunter tests require specific tools to be installed (lsof, ss, netstat, etc.). Install missing tools: apt install lsof net-tools. rkhunter will skip tests for missing tools without failing, but you lose coverage for those checks.
Problem: rkhunter –update fails with network error
Solution: The server may not have outbound HTTP access to the rkhunter update server (rkhunter.sourceforge.net). Check network connectivity: curl -I http://rkhunter.sourceforge.net. If blocked, download the database file manually on a system with internet access and transfer it to the server.
Summary
rkhunter provides automated rootkit detection and binary integrity verification that complements AIDE and manual checks. Its value is in continuous daily monitoring — a rootkit installed tonight will generate warnings in tomorrow’s scan. The critical operational practice is maintaining an up-to-date property database (run –propupd after every package update), reviewing all warnings rather than dismissing them, and cross-validating concerning findings with the package manager’s own hash verification tools.
- Run
rkhunter --propupdafter every package update — stale databases generate false positives that mask genuine warnings - Each WARNING requires individual evaluation — cross-validate with debsums or rpm -V before concluding a file is compromised
- Schedule daily runs with
--rwoand email alerting — a daily report with no warnings provides operational confidence; any warnings break that baseline
Related Commands
chkrootkit for complementary rootkit scanning • lynis for comprehensive security auditing • sha256sum for manual binary integrity verification • aide for file integrity monitoring
Are Your Servers Scanned Daily for Rootkits?
INTRAM deploys rkhunter with daily automated scanning, email alerting on warnings, and post-update property database maintenance on all managed Linux servers.
Deploy Rootkit Detection