A rootkit is one of the nastiest things that can land on a server. It hides files, processes, and network connections so an attacker keeps access while everything looks normal. A compromised VPS often keeps serving websites without a hiccup, so weeks can pass before anyone notices. Every VPS owner should know how to detect a rootkit on Linux VPS with chkrootkit, a free scanner that checks system binaries and kernel modules for known signs of tampering. This guide covers installation, a full scan, reading the output, and the next steps.
What a Rootkit Does on a Linux VPS
A rootkit is not a virus in the usual sense. It is a set of tools that gives an attacker root access and then hides the evidence. Once installed, it can replace commands such as ps, ls, and netstat with doctored versions that skip the attacker’s processes and files, and it can load a kernel module that hides traffic and log entries. The server then lies to you about its own state.
Attackers use rootkits for quiet, long-term access. A hijacked VPS can send spam, mine cryptocurrency, host phishing pages, or attack other machines. The owner often finds out only when a provider suspends the account, so catching it early is far cheaper than cleaning up after it.
Rootkit Symptoms Your VPS Might Show
Rootkits are built to stay invisible, but they still leave traces. The rootkit symptoms VPS owners report most often include a sudden jump in CPU or network usage with no matching process in top, log files with unexplained gaps, and binaries whose modification dates do not match the last update. Other signs are SSH logins from places you never visited, cron jobs you did not create, and outbound connections to unknown addresses.
None of these signs proves a rootkit on its own. A traffic spike can come from a bot scraping your site, and a missing log line can come from a rotation mistake. Treat the signs as a reason to scan, not as a verdict. Compare what you see against our guide on the eight warning signs of a compromised server.
How to Detect a Rootkit on Linux VPS with Chkrootkit
Chkrootkit is a small shell-script scanner that has been around for years. It checks binaries, libraries, and system files against known rootkit signatures, and it looks for suspicious kernel modules and hidden processes. It is not perfect, but it is fast, free, and a solid first pass before deeper tools. A chkrootkit Linux scan takes only a few minutes on a typical VPS.
Install Chkrootkit on Ubuntu and Debian
On Ubuntu 24.04 and Debian 12, chkrootkit is in the default repositories. Install it with one command:
sudo apt update && sudo apt install chkrootkit -y
CentOS and AlmaLinux users can install it from EPEL, while Arch users will find it in the AUR. Avoid downloading random binaries from forums: a security tool from an untrusted source can do more harm than the rootkit you are hunting.
Run Your First Scan
Run the scanner as root so it can read every file it needs to check:
sudo chkrootkit
The scan checks dozens of items and prints not found or not infected for each clean test. For a quieter run that only reports problems, add the -q flag. Save the output to a file so you can read it calmly instead of watching it scroll past:
sudo chkrootkit > /root/chkrootkit-scan.txt 2>&1
Run the scan when the server is quiet, ideally after a reboot, when fewer processes run and odd entries stand out. Schedule a weekly repeat scan with cron so a future infection does not sit unnoticed for months.
Read the Results Without Panicking
Most lines will say clean. The ones that matter are marked INFECTED or report a suspicious file. Before you act, check whether the warning is a known false positive. The table below covers the warnings VPS owners meet most often.
| Chkrootkit warning | What it usually means | What to do |
|---|---|---|
Checking `ifconfig'... INFECTED |
Often a false positive from a newer ifconfig binary | Compare it against the package version with dpkg -V |
Checking `ls'... INFECTED |
A replaced binary, or an ls version chkrootkit does not expect |
Verify the hash against the package database |
Searching for suspicious files... found |
A hidden file or directory in a system path | Inspect it yourself; delete nothing until you know what it is |
Checking `lkm'... hidden process |
A kernel module may be hiding a process | Cross-check with rkhunter and inspect modules with lsmod |
Checking `sniffer'... PACKET SNIFFER |
An interface is in promiscuous mode | Find which process opened it; on a VPS this is often a false alarm |
A single INFECTED line is not proof of a compromise. Chkrootkit compares signatures against patterns that can lag behind distribution updates, so clean systems trigger false alarms. Worry when you see a pattern: several infected binaries at once, hidden processes, and suspicious files together. If you see that combination, treat the server as compromised.
Cross-Check with rkhunter and ClamAV
One scanner is never enough for a serious check. The classic comparison is rkhunter vs chkrootkit: chkrootkit looks for known rootkit signatures, while rkhunter checks file hashes against a baseline and hunts for hidden files and suspicious kernel modules. Running both covers more ground than either alone, and when they agree, you can trust the result much more.
Install rkhunter alongside chkrootkit and run a full check:
sudo apt install rkhunter -y
sudo rkhunter --update
sudo rkhunter --check --skip-keypress
ClamAV adds a third angle by scanning files for malware payloads, which rootkits sometimes drop alongside their hiding tools. Our guide on how to scan a Linux server for malware with ClamAV and rkhunter walks through both tools step by step. If all three scanners come back clean, the server is probably fine.
Check Your Login Records Too
A rootkit rarely appears on its own. It usually follows a break-in through a weak password, an exposed service, or a stolen key. Before you trust a clean scan, check who has been logging in: look at /var/log/auth.log for logins you do not recognise, and check lastlog for accounts that should be dormant. Our walkthrough on how to audit who logged into your VPS shows which commands to run and what a suspicious entry looks like. If you find a login you cannot explain, change every password and SSH key on the server, then scan again.
What to Do If the Scan Finds Something
Finding a real rootkit means the server can no longer be trusted. The honest answer about how to remove a rootkit Ubuntu administrators rely on is that you do not clean it in place. A rootkit can hide in the kernel or in boot files, so no scan can prove every trace is gone. The safe path is a full rebuild.
Start by taking the server offline or blocking its network access so it cannot attack others or leak more data. Copy the data you need, such as website files and database dumps, to a clean machine, and scan every file with ClamAV before restoring it. Never copy binaries or system files from the infected machine. Then wipe the VPS, reinstall from a fresh image, restore only the data you scanned, and change every credential that ever touched the server. A snapshot taken before the infection turns the rebuild into a one-hour job instead of a weekend of guesswork.
Harden the Server After a Clean Scan
A clean scan is a good moment to close the gaps that let attackers in: key-only SSH login, a firewall that allows only the ports you use, and automatic security updates so patches land without you remembering. Our guide on how to harden a fresh Ubuntu server covers the first fifteen minutes in order, and pairing it with automatic security updates keeps the server patched after you finish.
Then make scanning a habit. Put chkrootkit and rkhunter in a weekly cron job, send the output to your email, and read it. A scan you never read is the same as a scan you never ran. Linux rootkit detection works best as a routine: install the tools once, run them on a schedule, and act fast when the output changes.
FAQ
Is chkrootkit enough to prove my VPS is clean?
No. Chkrootkit catches known rootkit signatures, but a new or custom rootkit can slip past it. Pair it with rkhunter and check your login records. A clean result from several tools is strong evidence, not a guarantee.
How often should I run a rootkit scan?
Weekly is a sensible rhythm for a production VPS, and monthly is the minimum for a small personal server. Run an extra scan after any suspicious event, such as an unexplained login or a sudden traffic spike.
Can chkrootkit remove a rootkit it finds?
No, chkrootkit only detects. If a scan confirms an infection, back up your data, wipe the server, and rebuild from a fresh image.