How to Install chkrootkit on Ubuntu

Install chkrootkit on Ubuntu from the Universe repository (0.58b on 25.04), run quiet or scoped scans with timeout, enable the systemd daily timer, interpret INFECTED and PACKET SNIFFER false positives, and pair with rkhunter for broader rootkit coverage.

Published

Updated

Read time 7 min read

Reviewed byDeepak Prasad

Install chkrootkit on Ubuntu banner with security shield and rootkit scan motif on Ubuntu orange accent

chkrootkit (Check Rootkit) is a classic Unix rootkit scanner: a shell script plus helper binaries that look for known rootkit signatures, tampered system commands, suspicious kernel modules, and packet sniffers. It is not a replacement for antivirus or intrusion detection, but it is a useful second opinion on servers you already harden with updates and firewall rules.

This guide covers how to install chkrootkit on Ubuntu from apt, run scans without waiting forever on a full-system walk, enable packaged daily checks, and read results without panicking over common false positives. I ran these steps on Ubuntu 25.04 and kept real output below.

Tested on: Ubuntu 25.04 (Plucky Puffin); kernel 6.14.0-37-generic.

IMPORTANT
A plain sudo chkrootkit scans the live system at ROOTDIR=/—dozens of binary checks plus hidden-file sweeps across /usr, /lib, /var, and more. It is not the chroot command, but it does behave like a full-OS audit and can run many minutes with sparse output. For interactive use prefer chkrootkit -q; for automation wrap runs in timeout (for example timeout 300 sudo chkrootkit -q).

Quick command summary

Task Command
Install chkrootkit sudo apt install -y chkrootkit
Check package version chkrootkit -V
List available tests chkrootkit -l
Full live-system scan sudo chkrootkit (slow—see timeout below)
Quiet scan (warnings only) sudo chkrootkit -q
Scan with time limit timeout 300 sudo chkrootkit -q
Scan one test only sudo chkrootkit sshd
Scan alternate root (forensics) sudo chkrootkit -r /mnt/suspect-root
Validate daily timer systemctl status chkrootkit.timer
Edit daily scan config sudo nano /etc/chkrootkit/chkrootkit.conf
Remove package sudo apt purge -y chkrootkit

Prerequisites

  • Ubuntu 22.04 LTS, 24.04 LTS, or newer (25.04 tested here) with the Universe repository enabled.
  • sudo for installation and system-wide scans.
  • Root privileges for meaningful scans—chkrootkit compares live /bin, /sbin, and process tables.
  • Patience or timeout for full scans; a quiet scan on my host finished within ~90 seconds, while an unrestricted full run can exceed ten minutes on a busy disk.
  • Optional companion: rkhunter rootkit scanner guide for overlapping coverage.

What chkrootkit actually scans

Scope Command What it does
Live system (default) sudo chkrootkit ROOTDIR is /—checks system binaries (ps, sshd, ls, …), LKM/sniffer tests, and suspicious hidden paths across the running OS
Directory / mount sudo chkrootkit -r /opt Treats /opt as root—useful for offline forensics on a mounted disk image
Single signature sudo chkrootkit sshd Runs only the sshd test against the live system
Quiet summary sudo chkrootkit -q Suppresses most not infected lines; still walks the system

chkrootkit does not recursively virus-scan every file like ClamAV. It runs a fixed battery of rootkit-specific tests. The long runtime comes from external commands, strings comparisons, and hidden-file discovery under large trees like /usr/lib.


Step 1: Install chkrootkit from apt

Refresh indexes and install from Universe:

bash
sudo apt update
sudo apt install -y chkrootkit

On Ubuntu 25.04:

bash
apt-cache policy chkrootkit
text
Installed: 0.58b-4
Candidate: 0.58b-4
     0.58b-4 500
        500 http://archive.ubuntu.com/ubuntu plucky/universe amd64 Packages

Verify the binary:

bash
chkrootkit -V
text
chkrootkit version 0.58b
NOTE
The package name is chkrootkit, not chrootkit or checkrootkit. Ubuntu 22.04 LTS still packages 0.55; 24.04 and 25.04 ship the 0.58b line per Launchpad.

Step 2: Run your first scan (with a timeout)

bash
timeout 300 sudo chkrootkit -q

On my Ubuntu 25.04 host the quiet scan reported warnings, not INFECTED, for dotfiles owned by normal packages:

text
WARNING: The following suspicious files and directories were found:
/usr/lib/modules/6.14.0-37-generic/vdso/.build-id [From Debian package: linux-modules-6.14.0-37-generic]
/usr/lib/node_modules/npm/.npmrc [From Debian package: nodejs]
/usr/lib/python3/dist-packages/fail2ban/tests/files/config/apache-auth/digest/.htaccess [From Debian package: fail2ban]

The [From Debian package: …] suffix on Ubuntu 0.58b means dpkg owns the path—treat these as false positives unless other evidence contradicts it. Confirm with:

bash
dpkg -S /usr/lib/modules/6.14.0-37-generic/vdso/.build-id

Full verbose scan (expect a long run)

bash
timeout 600 sudo chkrootkit 2>&1 | tee /tmp/chkrootkit-full.log

The first lines show the live root:

text
ROOTDIR is `/'
Checking `amd'...                                           not found
Checking `basename'...                                      not infected
Checking `chfn'...                                          not infected
Checking `sshd'...                                          not infected
  • not infected — test passed for that binary/signature.
  • not found — target not installed (common for legacy daemons).
  • not tested — skipped (missing helper or irrelevant on this system).
  • INFECTED — investigate immediately, but verify with package checksums before assuming compromise.

Single-test and scoped scans (fast)

bash
sudo chkrootkit sshd
text
ROOTDIR is `/'
Checking `sshd'...                                          not infected

Scan only an alternate directory (for example a mounted suspect disk):

bash
sudo chkrootkit -r /opt
text
ROOTDIR is `/opt/'
Checking `basename'...                                      not found

List every test name:

bash
chkrootkit -l | fold -s | head -5
text
/usr/sbin/chkrootkit: tests: aliens asp bindshell lkm rexedcs sniffer ...

Step 3: Enable and tune daily scans

Ubuntu 25.04 ships both a systemd timer and a legacy cron script:

bash
systemctl is-enabled chkrootkit.timer
systemctl is-active chkrootkit.timer
ls -la /etc/cron.daily/chkrootkit
text
enabled
active
-rwxr-xr-x 1 root root 161 ... /etc/cron.daily/chkrootkit

Configuration moved to /etc/chkrootkit/chkrootkit.conf (not /etc/chkrootkit.conf as older tutorials state):

bash
grep -E '^RUN_DAILY|^RUN_DAILY_OPTS|^DIFF_MODE|^MAILTO' /etc/chkrootkit/chkrootkit.conf

Default highlights from the packaged file:

text
RUN_DAILY="true"
RUN_DAILY_OPTS=""
DIFF_MODE="true"

For quieter daily mail, set:

bash
sudo sed -i 's/^RUN_DAILY_OPTS=.*/RUN_DAILY_OPTS="-q"/' /etc/chkrootkit/chkrootkit.conf

Review the first automated run:

bash
sudo less /var/log/chkrootkit/log.today

When output is clean, establish a baseline for diff mode:

bash
sudo cp -a /var/log/chkrootkit/log.today /var/log/chkrootkit/log.expected

Add reviewed false positives to /etc/chkrootkit/chkrootkit.ignore.

Optional cron wrapper with timeout

If you schedule a custom cron job instead of the packaged timer, always cap runtime:

bash
sudo tee /usr/local/bin/chkrootkit-safe.sh << 'EOF'
#!/bin/sh
timeout 900 /usr/sbin/chkrootkit -q >> /var/log/chkrootkit/manual.log 2>&1
EOF
sudo chmod +x /usr/local/bin/chkrootkit-safe.sh

Step 4: Interpret warnings and false positives

Output Meaning Next step
not infected No signature match None
INFECTED Pattern matched Verify with dpkg -S, debsums, and a second scanner
PACKET SNIFFER Process uses PF_PACKET Often NetworkManager, dhclient, or monitoring—check ss -lp | grep PACKET
WARNING: suspicious files with package tag Packaged dotfile False positive on modern Ubuntu builds
not tested Skipped check Install missing helper (for example psmisc for pstree)

If you suspect a real rootkit, do not trust local ps/ls alone—boot trusted live media and scan the mounted root read-only:

bash
sudo chkrootkit -r /mnt/suspect-root

Pair results with rkhunter for broader file-property checks.


Uninstall

bash
sudo systemctl disable --now chkrootkit.timer
sudo apt purge -y chkrootkit
sudo apt autoremove -y

Remove logs when you no longer need history:

bash
sudo rm -rf /var/log/chkrootkit

Troubleshooting

Symptom Likely cause Fix
Command appears hung Full scan still walking / Use -q, single tests, -r, or timeout 300
Unable to locate package chkrootkit Universe disabled sudo add-apt-repository universe && sudo apt update
Daily mail is huge Default verbose daily run Set RUN_DAILY_OPTS="-q" in chkrootkit.conf
grep /etc/chkrootkit.conf fails Path changed on newer Ubuntu Use /etc/chkrootkit/chkrootkit.conf
Many WARNING lines with package names Normal on dev servers Add to chkrootkit.ignore after review
pstree not tested Missing binary sudo apt install -y psmisc

References


Summary

Install chkrootkit on Ubuntu with sudo apt install chkrootkit from Universe—it delivered 0.58b on 25.04. A default sudo chkrootkit is a full live-system rootkit audit (ROOTDIR=/), not a quick malware click; that is why earlier test runs looked stuck until we added timeout and switched to -q for routine checks.

Use chkrootkit -q day to day, chkrootkit sshd (or other single tests) for spot checks, and chkrootkit -r when you scan a mounted disk offline. chkrootkit.timer handles daily runs on current Ubuntu—tune /etc/chkrootkit/chkrootkit.conf so mail stays readable. Treat package-tagged warnings as leads to verify, not automatic proof of compromise.


Frequently Asked Questions

1. How do I install chkrootkit on Ubuntu?

Run sudo apt update && sudo apt install -y chkrootkit from the Universe repository. The package installs /usr/sbin/chkrootkit, enables chkrootkit.timer for daily scans on current Ubuntu releases, and drops configuration under /etc/chkrootkit/chkrootkit.conf.

2. Is chkrootkit in the default Ubuntu repository?

Yes, in the Universe component. On Ubuntu 25.04 the package is chkrootkit 0.58b-4. Ubuntu 22.04 LTS ships 0.55. Run apt-cache policy chkrootkit to see the candidate on your release.

3. Does chkrootkit scan the entire operating system?

A default sudo chkrootkit run uses ROOTDIR=/ and checks dozens of system binaries, processes, kernel modules, and hidden-file patterns across the live system. It is not instant—budget several minutes on busy servers. Use chkrootkit -r /path for an offline mount, single tests like chkrootkit sshd, or wrap long runs in timeout for automation.

4. Why does chkrootkit seem stuck or hang?

Full scans walk the whole live filesystem and run many subprocess checks. On a server with large /usr or /var trees the run can exceed ten minutes with little console output. Use chkrootkit -q for faster review, scope with -r, test one signature at a time, or run timeout 300 sudo chkrootkit -q in scripts.

5. What does chkrootkit -q do?

Quiet mode prints warnings and positive findings instead of every not infected line. On Ubuntu 25.04 it still listed package-owned dotfiles tagged [From Debian package: ...] on my host—those are common false positives, not rootkits.

6. How do I schedule daily chkrootkit scans on Ubuntu?

On Ubuntu 24.04 and newer the package enables chkrootkit.timer (systemctl status chkrootkit.timer). Edit /etc/chkrootkit/chkrootkit.conf: RUN_DAILY=true, set RUN_DAILY_OPTS="-q" for quieter mail, and review /var/log/chkrootkit/log.today after the first run.

7. What is the difference between chkrootkit and rkhunter?

chkrootkit is lightweight and signature-focused. rkhunter adds file-property baselines and more configuration checks. Many admins run both and compare warnings. See the rkhunter guide on this site for the companion workflow.

8. How do I uninstall chkrootkit from Ubuntu?

Run sudo apt purge -y chkrootkit && sudo apt autoremove -y. Remove /var/log/chkrootkit if you no longer need scan history. Disable chkrootkit.timer first with sudo systemctl disable --now chkrootkit.timer when you want scans to stop immediately.
Deepak Prasad

R&D Engineer

Founder of GoLinuxCloud with more than 15 years of expertise in Linux, Python, Go, Laravel, DevOps, Kubernetes, Git, Shell scripting, OpenShift, AWS, Networking, and Security. With extensive …