Installing RootKit Hunter on Linux – A Quick Guide to Detecting Rootkits
If you’ve ever wondered whether your server might be silently running malware, installing RootKit Hunter (rkhunter) is a low‑effort way to keep an eye on the things that should stay hidden. In this article I’ll walk you through getting rkhunter up and running from the command line, updating its signature database, and setting it to run automatically so you never miss a flag.
Step 1: Identify Your Package Manager
First thing’s first – find out if your distro uses apt, yum/dnf, or pacman. Knowing this will tell you which package to pull:
- Ubuntu/Debian => apt
- CentOS/RHEL/Fedora => yum or dnf
- Arch => pacman
Why it matters: the same command works on one system but not another; a missing repo can make your install stall.
Step 2: Install the rkhunter Package
# Debian/Ubuntu sudo apt update && sudo apt install rkhunter -y # CentOS/RHEL/Fedora sudo yum install rkhunter -y # or dnf on newer Fedora # Arch sudo pacman -S rkhunter
The -y flag saves you from a “Do you want to continue?” pause. rkhunter ships with a decent set of pre‑built signatures, but you’ll need to refresh them for the latest threats.
Step 3: Update the Signature Database
sudo rkhunter --update
This pulls the newest rootkit signatures from the maintainers’ servers. Without it, your scans will look like a throwback to 2009 – and that’s not very helpful when attackers keep inventing new tricks.
Step 4: Run an Initial Scan and Review the Log
sudo rkhunter --checkall
After the scan finishes, open /var/log/rkhunter.log or run:
cat /var/log/rkhunter.log | tail -n 50
You’ll see lines like “Potential rootkit detected in /usr/bin/sshd” (just an example). If you’re a developer who occasionally compiles things from source, you might get false positives on custom binaries; that’s why reading the log is essential.
> I’ve seen this happen after a bad driver update – a kernel module gets flagged because its name matches a known rootkit pattern. In that case, ignoring the alert and double‑checking the file with file or sha256sum usually clears it up.
Step 5: Automate Daily Scans with Cron
Create a simple cron job:
sudo crontab -e
Add this line to run rkhunter every day at 3 am:
0 3 * /usr/sbin/rkhunter --cronjob --update > /dev/null 2>&1
Rootkits often hide for months. Running a scan nightly keeps your eyes on the back of your head without you having to remember it.
Common Pitfalls and Quick Fixes
- False positives: If rkhunter flags something that’s clearly legitimate, add its path to /etc/rkhunter.conf under SKIP_FILES.
- Permission errors: Make sure you run scans as root; otherwise, directories like /usr/sbin won’t be examined.
- Database lockouts: If the update fails because of a stale lock file, delete /var/lib/rkhunter/.lock.
RootKit Hunter isn’t a silver bullet – it’s part of a broader security strategy. Combine it with chkrootkit, regular patching, and good firewall hygiene for best results.
Hope that helps! Keep your system clean, and happy hunting.