rkhunter, short for Rootkit Hunter, is an open-source host-based scanner that detects signs of rootkits, backdoors and local exploits on Unix-like systems. It compares system binaries with a stored baseline of file properties, searches for files and strings associated with known rootkits, and inspects configuration details that attackers commonly change. In Linux security it belongs to the family of post-compromise detection tools, alongside chkrootkit for rootkit signatures and AIDE for general file integrity monitoring.
The tool is a collection of shell scripts with a small set of data files, which makes it easy to install on almost any distribution. It does not block attacks or remove malware; its value lies in raising warnings that an administrator must investigate.
How rkhunter detects rootkits
rkhunter combines several independent test groups, because no single technique catches every rootkit. A rootkit typically hides files, processes and network connections by replacing system utilities or loading a malicious kernel module, so the scanner looks both for known artifacts and for inconsistencies that hiding leaves behind.
The most important mechanism is the file properties check. After a clean installation, the command rkhunter --propupd records hashes, permissions, owners, sizes and modification times of critical binaries such as ls, ps, netstat and login. Later scans compare the live files with this baseline, and any difference produces a warning. On systems where the configuration option PKGMGR is set, rkhunter can also verify files against the package database of dpkg or RPM.
The table below lists the main test groups and what they reveal.
| Test group | What it examines | Typical finding |
|---|---|---|
| File properties | Hashes and attributes of system binaries | Modified or replaced command |
| Known rootkit files | Paths and names used by rootkit families | Files of a known rootkit |
| Malware strings | Suspicious strings in binaries and modules | Backdoor signatures |
| Hidden files and directories | Unusual dot files in system paths | Concealed attacker tools |
| Network checks | Backdoor ports and promiscuous interfaces | Packet sniffer or listener |
| System configuration | SSH settings, startup files, accounts | Root login allowed over SSH |
Commands and configuration
rkhunter is driven by a compact command-line interface and a single configuration file, usually /etc/rkhunter.conf, with local overrides in rkhunter.conf.local on many distributions. Results are written to /var/log/rkhunter.log, which contains far more detail than the terminal output.
| Command | Purpose | When to run it |
|---|---|---|
rkhunter --check --sk | Runs all tests without pausing | Regular scans and cron jobs |
rkhunter --propupd | Rebuilds the file properties baseline | After verified system updates |
rkhunter --update | Refreshes signature data files | Periodically, before scanning |
rkhunter --check --rwo | Reports warnings only | Automated reporting |
rkhunter --list tests | Shows available test names | When tuning enabled tests |
rkhunter --versioncheck | Checks for a newer program version | During maintenance |
The configuration file controls which tests run and which findings are expected. Options such as ALLOWHIDDENDIR, ALLOWHIDDENFILE, SCRIPTWHITELIST and ALLOWDEVFILE whitelist legitimate exceptions, while MAIL-ON-WARNING sends results to an administrator. Distribution packages typically add a daily cron job or systemd timer that runs the check automatically.
How rkhunter compares with related security tools
rkhunter overlaps with other integrity and malware tools, but each one answers a different detection question. Administrators often run two of them together to compensate for individual blind spots.
| Tool | Primary approach | Strength | Main limitation |
|---|---|---|---|
| rkhunter | Signatures plus binary baseline | Broad rootkit and configuration checks | Frequent false positives |
| chkrootkit | Signature and anomaly tests | Very lightweight and independent | Limited baseline comparison |
| AIDE | File integrity database | Detects any change to chosen files | No rootkit knowledge |
| ClamAV | Antivirus signatures | Large malware database | Weak against kernel rootkits |
| Lynis | Security auditing | Hardening recommendations | Not a compromise detector |
A key conceptual limit applies to all of them: a scanner running on a compromised host relies on that host to tell the truth. An advanced kernel-level rootkit can intercept system calls and present clean data to rkhunter, so the most reliable verification is an offline scan from trusted boot media.
Interpreting warnings and avoiding false positives
Most rkhunter warnings on a healthy system are false positives caused by legitimate changes. The scanner cannot distinguish an attacker replacing a binary from a package update replacing it, so every warning needs context before it is treated as an incident.
| Warning | Frequent harmless cause | Recommended response |
|---|---|---|
| File properties have changed | Package update after the last baseline | Verify with the package manager, then run –propupd |
| Script replaced a binary | Distribution ships a wrapper script | Confirm origin and add to SCRIPTWHITELIST |
| Hidden directory found | Legitimate dot directory in /etc or /dev | Inspect and whitelist with ALLOWHIDDENDIR |
| SSH root access allowed | Default or deliberate SSH setting | Disable root login or document the exception |
| Suspicious network port | Legitimate service on a listed port | Identify the process with ss and whitelist |
The most dangerous mistake is updating the baseline without verification. Running --propupd automatically after every update, or after an unexplained warning, silently accepts whatever is on disk and can legitimize an attacker’s modified binaries. Package updates should be checked first, ideally with the package manager’s own verification tools.
Limitations and maintenance status
rkhunter is a mature but slowly evolving project. Its signature data covers mainly older, well-documented rootkit families, and development activity has been limited for years, so it should be treated as one layer of defense rather than a complete answer to modern Linux threats.
- Signature coverage ages: new or custom rootkits often leave no known file names or strings.
- Runtime trust problem: results from a live compromised system may be manipulated.
- Noise from updates: rolling-release distributions generate frequent baseline changes.
- No prevention: it detects after the fact and complements, not replaces, controls such as SELinux, AppArmor and kernel lockdown.
A non-technical view
Imagine a burglar who breaks into a house and then replaces the security cameras with fake ones that always show an empty room. A rootkit does the same to a computer: it hides itself by tampering with the tools that would reveal it.
rkhunter is like a guard who took detailed photographs of every camera on the first day. On each patrol, the guard compares the cameras with the photos and checks for tools that known burglars leave behind. It cannot stop a break-in, but it can notice that something was swapped.
A concrete example
A hosting provider runs about forty Debian web servers. After building each server, the operations team installs rkhunter, runs rkhunter --propupd to record a clean baseline and enables a daily scan with --check --sk --rwo, sending warnings to a shared mailbox.
One morning, a single server reports that /usr/bin/ps and /usr/bin/netstat have changed, although no package updates were installed that night. The package manager’s verification confirms that both files no longer match their published checksums. The team isolates the server, boots it from trusted media and finds a user-space rootkit installed through a vulnerable web application. The early warning limited the incident to one machine, and the server was rebuilt from a clean image instead of being trusted again.