rkhunter

Also known as: Rootkit Hunter

On this page 7

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 groupWhat it examinesTypical finding
File propertiesHashes and attributes of system binariesModified or replaced command
Known rootkit filesPaths and names used by rootkit familiesFiles of a known rootkit
Malware stringsSuspicious strings in binaries and modulesBackdoor signatures
Hidden files and directoriesUnusual dot files in system pathsConcealed attacker tools
Network checksBackdoor ports and promiscuous interfacesPacket sniffer or listener
System configurationSSH settings, startup files, accountsRoot login allowed over SSH
Main test groups in rkhunter

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.

CommandPurposeWhen to run it
rkhunter --check --skRuns all tests without pausingRegular scans and cron jobs
rkhunter --propupdRebuilds the file properties baselineAfter verified system updates
rkhunter --updateRefreshes signature data filesPeriodically, before scanning
rkhunter --check --rwoReports warnings onlyAutomated reporting
rkhunter --list testsShows available test namesWhen tuning enabled tests
rkhunter --versioncheckChecks for a newer program versionDuring maintenance
Frequently used rkhunter commands

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.

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.

ToolPrimary approachStrengthMain limitation
rkhunterSignatures plus binary baselineBroad rootkit and configuration checksFrequent false positives
chkrootkitSignature and anomaly testsVery lightweight and independentLimited baseline comparison
AIDEFile integrity databaseDetects any change to chosen filesNo rootkit knowledge
ClamAVAntivirus signaturesLarge malware databaseWeak against kernel rootkits
LynisSecurity auditingHardening recommendationsNot a compromise detector
rkhunter compared with related tools

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.

WarningFrequent harmless causeRecommended response
File properties have changedPackage update after the last baselineVerify with the package manager, then run –propupd
Script replaced a binaryDistribution ships a wrapper scriptConfirm origin and add to SCRIPTWHITELIST
Hidden directory foundLegitimate dot directory in /etc or /devInspect and whitelist with ALLOWHIDDENDIR
SSH root access allowedDefault or deliberate SSH settingDisable root login or document the exception
Suspicious network portLegitimate service on a listed portIdentify the process with ss and whitelist
Common warnings and appropriate responses

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.