Best Linux Scanning Tools to Find Hidden Threats

Linux scanning tools are the fastest way to keep a server secure, whether you are managing your first VPS, running a website, or maintaining production infrastructure. Every server can have security weaknesses, such as outdated software, misconfigured services, weak file permissions, exposed network ports, or malicious files. If these issues go unnoticed, attackers may exploit them to gain unauthorized access, steal data, or disrupt services.

This is where Linux scanning tools become useful. They help identify security weaknesses by checking installed packages, system configurations, running services, files, and network exposure. However, not every scanner checks the same things. For example, a network scanner can identify open ports and vulnerable services, while a host-based security auditing tool can detect weak configurations and missing security settings. Using different scanning tools together provides a more complete picture of your server's security.

In this guide, we explore 10 free and open-source Linux vulnerability scanning and security auditing tools, including Lynis, Nmap, Trivy, OpenVAS, ClamAV, rkhunter, AIDE, and OpenSCAP. You will learn what each tool does, how to install and run it, how to understand its scan results, and when to use it. We also provide practical commands for Ubuntu, Debian, RHEL, Rocky Linux, and other supported distributions, along with recommendations for building a regular Linux server security scanning routine.

♦ BLACK FRIDAY HOSTING DEALSLooking for reliable Linux VPS and cloud hosting? Compare exclusive deals from Cloudways, Verpex and DigitalOcean and more.♦ VIEW ALL DEALS →

Why Hidden Threats Slip Past a Single Linux Vulnerability Scanner

No single Linux vulnerability scanner sees everything. A network scanner sees open ports and service banners. A host-based Linux security audit tool sees weak configs, world-writable files and missing patches. A rootkit scanner looks for tampered binaries. A malware scanner checks file contents. File integrity monitoring tells you what changed since your last known good state. Attackers live in the gaps between those views.

It helps to know the four types of Linux scanning tools before you pick any. Network-based scanners (Nmap, OpenVAS) probe hosts over the wire, the way an attacker would. Host-based scanners (Lynis, Trivy, OpenSCAP) run on the server itself and read packages and configs directly, which makes them more accurate. Web application scanners like Nikto and ZAP (now ZAP by Checkmarx) test the sites you host for things like outdated server software, SQL injection and cross-site scripting. Container security scanners like Trivy, Grype and Clair check image layers before they ever reach production. A proper vulnerability assessment uses at least one from each group that applies to you.

The numbers back this up. Here is why vulnerability management deserves a fixed slot in your ops calendar rather than a once-a-year audit panic:

Metric Value Source Relevance
Average cost of a data breach $4.44 million IBM Cost of a Data Breach Report 2025 Free scanners cost nothing next to one incident
Breaches starting with a vulnerability exploit 20% Verizon DBIR 2025 Unpatched services are a top entry point
CVEs published in 2024 40,000+ NVD / CVE Program Nobody tracks this by hand, CVE scanning has to be automated
Median time to patch edge-device CVEs 32 days Verizon DBIR 2025 A month of exposure is normal, weekly scans shrink it

Before running any scanner, get a quick baseline of what is listening. ss -tulpn takes two seconds and the ss(8) man page explains every column. If you want a deeper walkthrough of the flags, our ss command guide covers the ones I use daily. Anything listening that you cannot explain is your first finding, before a single tool runs.

For the broader threat picture this year (supply chain attacks, exposed container APIs, credential stuffing against SSH), the Linux security threats in 2026 breakdown is worth a read alongside this guide.

Prerequisites

Most of these Linux scanning tools are light. ClamAV and OpenVAS are the exceptions, and they are the two that cause the most trouble on small boxes. Check these before you start:

  • OS: Ubuntu 22.04 / 24.04 / 26.04 LTS, Debian 12+, Rocky Linux 9 / 10, RHEL 9 / 10 or AlmaLinux 9 / 10. Fedora 44 works with the same dnf commands minus EPEL.
  • CPU: 2 vCPU minimum. OpenVAS (Greenbone) wants 4 vCPU for anything beyond a handful of targets.
  • RAM: 2 GB for Lynis, rkhunter, chkrootkit, Nmap, Trivy, AIDE and OpenSCAP. 4 GB if you run ClamAV, since the signature database alone needs roughly 1.2 to 1.5 GB in memory. 8 GB for OpenVAS.
  • Disk: 5 GB free for tool databases (ClamAV signatures about 100 to 200 MB after the December 2025 signature cleanup, Trivy DB about 800 MB unpacked, AIDE database 50 to 200 MB). OpenVAS feeds need 20 GB or more.
  • Privileges: root or sudo. Rootkit checks, file integrity scans and SYN scans all read files or open raw sockets that normal users cannot touch.
  • Repos: EPEL enabled on RHEL/Rocky/AlmaLinux (sudo dnf install epel-release -y), then sudo crb enable on Rocky and AlmaLinux. On RHEL, enable CodeReady Builder through subscription-manager. Many EPEL packages fail to install without it.
  • Network: outbound HTTPS (443) to pull signature and CVE databases. Nmap scans of other hosts need written permission from whoever owns them.
  • A test box: run every tool on a throwaway VM first. A small Linux VPS at a few dollars a month is perfect for learning what normal output looks like before you point anything at production.
Warning:

Skip the RAM check and ClamAV will get OOM-killed halfway through a scan on a 1 GB VPS, often taking your web server or database down with it because the kernel picks the biggest process it can find. Skip the written-permission rule for Nmap and a hosting provider can suspend your account for scanning neighbours. Neither is hypothetical.

Linux Scanning Tools Compared at a Glance

Short answer: the best Linux scanning tools for most servers are Lynis for hardening audits, Trivy or your distro's security advisories for CVEs, AIDE for file integrity, and ClamAV plus rkhunter only where untrusted files land. Add OpenVAS or Vuls once you manage a fleet.

Use this table to decide which Linux security scanner answers which question. Most teams end up running four or five of these together, not just one.

Tool Type What It Finds Install Source Best For
Lynis Host security audit Weak configs, missing hardening, outdated packages Ubuntu repo / EPEL Every server, first scan you run
OpenVAS (Greenbone) Network vulnerability scanner Known CVEs on exposed services (enterprise feed 200,000+ tests, community feed smaller) Docker containers / source Fleet-wide authenticated scans
Nmap + vulners Network scanner Open ports, service versions, CVE hints Default repos Attack surface mapping
Trivy CVE scanning Vulnerable OS packages, container images, IaC Vendor apt/rpm repo Containers and CI pipelines
ClamAV Malware scanner Webshells, trojans, known malware signatures Ubuntu repo / EPEL Upload dirs, mail, shared storage
rkhunter Rootkit scanner Rootkits, tampered binaries, odd file properties Ubuntu repo / EPEL Weekly integrity sanity check
chkrootkit Rootkit scanner Known rootkit signatures, promiscuous NICs Ubuntu repo / source Second opinion next to rkhunter
AIDE File integrity monitoring Any change to binaries, configs, permissions Default repos Detecting silent tampering
OpenSCAP Compliance scanning CIS, PCI-DSS, STIG rule failures Default repos (RHEL family) Audits and compliance reports
Vuls Agentless CVE scanner Missing patches over SSH, no agent installed Go binary / Docker Large fleets, minimal footprint

Production Tip:

If you only have time for three, start with Lynis (configuration), Trivy or your distro's own security tooling (CVEs), and AIDE (tampering). That combination covers the "is it weak", "is it unpatched" and "has it changed" questions. Add ClamAV only where untrusted files land, like upload folders and mail spools.

Are rkhunter, chkrootkit and ClamAV Still Worth Running?

Honest answer: yes, but only in the right place. This is the most argued-about question in Linux admin forums, and both sides have a point. rkhunter has had no upstream release since 2018 and both rootkit scanners throw false positives on modern systems, so they will not catch a skilled attacker on their own. ClamAV mostly ships signatures for Windows malware, which is why people call it useless on a Linux desktop.

Where they still earn their keep: ClamAV on upload folders, mail spools and Samba shares that Windows clients touch, and rkhunter or chkrootkit as a cheap weekly second opinion next to AIDE and package verification. Treat a rootkit scanner warning as a prompt to check with the package manager, never as proof on its own.

A quick word on what is not in the table. Nessus is the commercial vulnerability scanner Linux shops most often compare against OpenVAS. Its free Essentials tier now covers about 5 IPs on a 30-day license with a delayed plugin feed, which suits a lab, not a fleet. Wazuh (built on OSSEC) is an open source intrusion detection and SIEM platform that bundles file integrity monitoring, CVE detection and log analysis behind one dashboard, so it is a good fit once you outgrow scripts. osquery lets you query every host like a SQL database, for example listing every machine with a specific package version in seconds. All three complement the tools above rather than replace them.

Looking for firewalls, IDS and encryption tools rather than scanners? Our top Linux security tools roundup covers that wider toolkit.

Install and Run Each Scanner Step by Step

The steps start simple and build up. Steps 1 to 4 are the beginner essentials, Steps 5 to 7 add flags and combinations, Steps 8 to 10 are real-world setups I run on production hosts, Step 11 is the mistake I see most often, and Step 12 closes the loop by confirming your patches actually took effect. Commands are the same on Ubuntu 26.04 and Rocky Linux 10 unless a step says otherwise. Run them in order on a test box the first time.

Two tools from the comparison table, OpenVAS (Greenbone) and Vuls, are not covered step by step here. Both are fleet-scale platforms that need their own server, feed sync (OpenVAS needs a long first feed sync, and its free community feed now lags the enterprise feed) and scan targets, so they deserve a dedicated deployment guide. The eight tools below run on a single host in minutes.

Key Terms:

CVE: a public ID for a known vulnerability, like CVE-2024-6387. Backport: a security fix your distro copies into an older version without changing the version number. OVAL: machine-readable distro security data that scanners use to check whether a fix is installed. Baseline: a snapshot of what a clean system looks like, used for later comparison. False positive: a warning about a problem that is not really there.

About the Sample Output:

Every Expected output block below is sample output captured from our Ubuntu 24.04 and Rocky Linux 9 test VMs. Your timestamps, package versions, file counts and findings will be different, and that is normal. Use the samples to recognise the shape of a good or bad result, not to match numbers line for line.

Step 1 - Run a Lynis Security Audit (Beginner)

Lynis is a host-based security audit tool. It checks SSH settings, kernel parameters, file permissions, accounts, logging and installed packages against hardening best practice. It is the best first scan on any server.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt update
sudo apt install lynis -y
lynis show version

Expected output:

OUTPUT
Reading package lists... Done
Setting up lynis (3.0.9-1) ...
Processing triggers for man-db (2.12.0-4build2) ...
3.0.9

The version number confirms Lynis is on the PATH. Ubuntu 24.04 still ships 3.0.9, and Lynis now flags any release older than six months as outdated, so expect a warning about it. That is fine for a first audit. For the newest tests, use the official CISOfy repository or clone the GitHub repo.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install epel-release -y
sudo crb enable
sudo dnf install lynis -y
lynis show version

Expected output:

OUTPUT
Enabling CRB repo
Installed:
lynis-3.1.7-1.el9.noarch

Complete!
3.1.7

EPEL usually carries a newer build than Ubuntu. If you see No match for argument: lynis, EPEL is not enabled yet, run the first command again and check dnf repolist.

Now run the full system audit. It takes 1 to 3 minutes and changes nothing on the box:

bash
LinuxTeck.com
sudo lynis audit system

Expected output:

OUTPUT
Lynis security scan details:

Hardening index : 64 [############ ]
Tests performed : 262
Plugins enabled : 1

Components:
- Firewall [V]
- Malware scanner [X]

Scan mode:
Normal [V] Forensics [ ] Integration [ ] Pentest [ ]

Lynis modules:
- Compliance status [?]
- Security audit [V]
- Vulnerability scan [V]

Files:
- Test and debug information : /var/log/lynis.log
- Report data : /var/log/lynis-report.dat

The hardening index is a rough score out of 100. A fresh cloud image usually lands between 55 and 65. The red X next to Malware scanner just means Lynis did not find ClamAV or similar, which Step 2 fixes. Scroll up in the output for the Warnings and Suggestions blocks, those are your actual to-do list.

If you see Fatal: Not running as root the audit still runs but skips about a third of the tests. Re-run with sudo.

Step 2 - Scan for Malware with ClamAV (Beginner)

ClamAV is the standard open source malware scanner on Linux. It will not stop an attacker in real time, but it is very good at finding webshells, dropped trojans and malicious attachments sitting on disk.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt install clamav clamav-daemon -y
sudo systemctl status clamav-freshclam --no-pager | head -3

Expected output:

OUTPUT
Setting up clamav-freshclam (1.5.4+dfsg-0ubuntu0.24.04.1) ...
Setting up clamav (1.5.4+dfsg-0ubuntu0.24.04.1) ...
* clamav-freshclam.service - ClamAV virus database updater
Loaded: loaded (/usr/lib/systemd/system/clamav-freshclam.service; enabled)
Active: active (running) since Tue 2026-11-24 10:02:11 IST; 41s ago

On Ubuntu, freshclam starts automatically and downloads signatures in the background. Give it 2 to 5 minutes on first install before scanning.

If you run sudo freshclam by hand and see ERROR: Failed to lock the log file /var/log/clamav/freshclam.log, the background service already holds the lock. Stop it with sudo systemctl stop clamav-freshclam, run freshclam, then start the service again.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install clamav clamd clamav-update -y
sudo freshclam

Expected output:

OUTPUT
ClamAV update process started at Tue Nov 24 10:05:44 2026
daily.cvd database is up-to-date (version: 28012, sigs: 355781, f-level: 90, builder: svc.clamav-publisher)
main.cvd database is up-to-date (version: 63, sigs: 3287027, f-level: 90, builder: tomjudge)
bytecode.cvd database is up-to-date (version: 335, sigs: 86, f-level: 90, builder: raynman)

Three databases (main, daily, bytecode) mean signatures are ready. On RHEL-family systems you run freshclam yourself, or enable the clamav-freshclam timer for automatic updates.

On Rocky and RHEL with SELinux enforcing, clamd may log AVC denials when it reads home directories. Allow it with sudo setsebool -P antivirus_can_scan_system 1 instead of disabling SELinux. On RHEL and Rocky 10.1 or later, check getsebool -a | grep antivirus first, because these booleans moved with the EPEL policy split and may be missing. Our SELinux vs AppArmor guide explains why booleans are the right fix here.

Now scan the places where untrusted files land. Skip pseudo-filesystems, they slow the scan and can hang it:

bash
LinuxTeck.com
sudo clamscan -r -i --exclude-dir="^/proc" --exclude-dir="^/sys" --exclude-dir="^/dev" /home /var/www /tmp

Expected output:

OUTPUT
----------- SCAN SUMMARY -----------
Known viruses: 3642808
Engine version: 1.5.4
Scanned directories: 1843
Scanned files: 12904
Infected files: 0
Data scanned: 1.02 GB
Data read: 812.44 MB (ratio 1.28:1)
Time: 214.522 sec (3 m 34 s)
Start Date: 2026:11:24 10:14:02
End Date: 2026:11:24 10:17:36

-i prints only infected files, so a clean run shows just the summary. If you want to prove detection works, drop the standard EICAR test file into /tmp and re-run. It should show up as Win.Test.EICAR_HDB-1 FOUND. Delete it afterwards.

Step 3 - Hunt for Rootkits with rkhunter (Beginner)

rkhunter compares system binaries against known good hashes and properties, checks for known rootkit files, hidden directories and suspicious startup entries. It is noisy at first, then very useful once tuned.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo DEBIAN_FRONTEND=noninteractive apt install rkhunter -y
rkhunter --version | head -1

Expected output:

OUTPUT
Setting up rkhunter (1.4.6-12) ...
Rootkit Hunter 1.4.6

The noninteractive flag skips the Postfix mail prompt that rkhunter pulls in as a dependency. If you want email alerts later, configure Postfix separately.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install rkhunter -y
rkhunter --version | head -1

Expected output:

OUTPUT
Installed:
rkhunter-1.4.6-19.el9.noarch

Complete!
Rootkit Hunter 1.4.6

Same 1.4.6 release on both families. Upstream development stopped in 2018 and distros now ship patched 1.4.6 builds, so treat rkhunter as a cheap second opinion rather than a primary control.

Update the data files, record a baseline of current file properties, then run the check. Only do the baseline on a system you trust:

bash
LinuxTeck.com
sudo rkhunter --update
sudo rkhunter --propupd
sudo rkhunter --check --sk --rwo

Expected output:

OUTPUT
[ Rootkit Hunter version 1.4.6 ]

Checking rkhunter data files...
Checking file mirrors.dat [ No update ]
Checking file programs_bad.dat [ Updated ]
Checking file backdoorports.dat [ No update ]
[ Rootkit Hunter version 1.4.6 ]
File created: searched for 177 files, found 141
Warning: The SSH and rkhunter configuration options should be the same:
SSH configuration option 'PermitRootLogin': no
Rkhunter configuration option 'ALLOW_SSH_ROOT_USER': unset

--sk skips the "press Enter" pauses and --rwo prints warnings only. The SSH warning above is a harmless config mismatch, set ALLOW_SSH_ROOT_USER=no in /etc/rkhunter.conf to silence it. Full details always land in /var/log/rkhunter.log.

If you see Invalid WEB_CMD configuration option: Relative pathname: "/bin/false" on Ubuntu during --update, edit /etc/rkhunter.conf and set UPDATE_MIRRORS=1, MIRRORS_MODE=0 and WEB_CMD="". Debian ships updates disabled on purpose.

Step 4 - Get a Second Opinion with chkrootkit (Beginner)

chkrootkit checks for signatures of about 70 known rootkits plus signs like network interfaces in promiscuous mode. Running it next to rkhunter catches things one tool misses.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt install chkrootkit -y
sudo chkrootkit -q

Expected output:

OUTPUT
WARNING: The following suspicious files and directories were found:
/usr/lib/python3/dist-packages/fail2ban/tests/files/config/apache-auth/.htaccess
/usr/lib/python3/dist-packages/fail2ban/tests/files/config/apache-auth/basic/file/.htaccess

Quiet mode (-q) only prints anything suspicious. The hidden .htaccess files above belong to fail2ban's test suite and are a well-known false positive. Real trouble looks like INFECTED next to a binary such as ps or ls.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install chkrootkit -y
sudo chkrootkit -q

Expected output:

OUTPUT
Installed:
chkrootkit-0.58-0b.el9.x86_64

Complete!

No output after install means nothing suspicious was found. That is the result you want. Distro packages often trail the upstream chkrootkit release by a version or two, which is fine as long as the package still receives updates.

If you see No match for argument: chkrootkit, your EPEL mirror does not carry it for that release. Build it from the upstream tarball with make sense and run ./chkrootkit -q from the source folder, or lean on rkhunter alone.

Step 5 - Map Exposed Services and CVEs with Nmap (Intermediate)

Nmap shows the host the way an attacker sees it: which ports are open and what software answers. Adding the vulners script turns service versions into a CVE shortlist.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt install nmap -y

Expected output:

OUTPUT
Setting up nmap (7.94+git20230807.3be01efb1+dfsg-3build2) ...

Nmap 7.94 on Ubuntu 24.04 includes the vulners NSE script out of the box.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install nmap -y

Expected output:

OUTPUT
Installed:
nmap-3:7.92-3.el9.x86_64

Complete!

Rocky 9 ships Nmap 7.92, which also includes vulners. Older builds may not, see the troubleshooting note below.

Now run a full-port service scan with CVE lookups against a host you own. The sample target below is an Ubuntu 22.04 server on the same lab network. Replace the IP with your target:

bash
LinuxTeck.com
sudo nmap -sV --script vulners -p- --min-rate 1000 192.168.10.25

Expected output:

OUTPUT
Starting Nmap 7.94SVN ( https://nmap.org ) at 2026-11-24 11:02 IST
Nmap scan report for 192.168.10.25
Host is up (0.00041s latency).
Not shown: 65532 closed tcp ports (reset)
PORT STATE SERVICE VERSION
22/tcp open ssh OpenSSH 8.9p1 Ubuntu 3ubuntu0.10 (Ubuntu Linux; protocol 2.0)
| vulners:
| cpe:/a:openbsd:openssh:8.9p1:
| CVE-2023-38408 9.8 https://vulners.com/cve/CVE-2023-38408
| CVE-2024-6387 8.1 https://vulners.com/cve/CVE-2024-6387
80/tcp open http nginx 1.18.0 (Ubuntu)
3306/tcp open mysql MySQL 8.0.39-0ubuntu0.22.04.1

Service detection performed. Please report any incorrect results at https://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 38.21 seconds

Two findings matter here. First, MySQL on 3306 should almost never face the network, bind it to 127.0.0.1. Second, look at the SSH line. 3ubuntu0.10 already contains the backported fix for CVE-2024-6387, but vulners only sees the upstream version 8.9p1 and flags it anyway. Always confirm with your distro's security tracker before panicking.

If you see NSE: failed to initialize the script engine ... 'vulners' did not match a category, filename, or directory, your Nmap build is too old. Update Nmap or download vulners.nse into /usr/share/nmap/scripts/ and run sudo nmap --script-updatedb.

Engineer Note:

That SSH false positive is the single biggest complaint sysadmins have about version-based scanners. Ubuntu, Debian, RHEL and Rocky backport security fixes without bumping the upstream version number. A scanner that matches banners against the NVD will over-report. Tools that read your distro's own OVAL or security tracker data (Trivy, Vuls, OpenSCAP, Greenbone with authenticated scans) are far more accurate on Linux.

For more Nmap scan types like OS detection and UDP sweeps, see our Nmap command examples.

Step 6 - Scan Packages and Containers for CVEs with Trivy (Intermediate)

Trivy started as a container scanner but works just as well on a live host. It reads the package database and matches it against distro-aware CVE data, which makes it more accurate than banner matching.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt install wget gnupg -y
wget -qO - https://aquasecurity.github.io/trivy-repo/deb/public.key | gpg --dearmor | sudo tee /usr/share/keyrings/trivy.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/trivy.gpg] https://aquasecurity.github.io/trivy-repo/deb generic main" | sudo tee /etc/apt/sources.list.d/trivy.list
sudo apt update && sudo apt install trivy -y

Expected output:

OUTPUT
Get:5 https://aquasecurity.github.io/trivy-repo/deb generic InRelease [3,061 B]
Setting up trivy (0.76.2) ...

Trivy comes from the vendor's own signed repository, not the Ubuntu archive. Run trivy --version to see the exact release you got.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
cat << 'EOF' | sudo tee /etc/yum.repos.d/trivy.repo
[trivy]
name=Trivy repository
baseurl=https://aquasecurity.github.io/trivy-repo/rpm/releases/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://aquasecurity.github.io/trivy-repo/rpm/public.key
EOF
sudo dnf install trivy -y

Expected output:

OUTPUT
Trivy repository 12 kB/s | 3.1 kB 00:00
Installed:
trivy-0.76.2-1.x86_64

Complete!

The quoted 'EOF' keeps $basearch literal so dnf expands it, not your shell. If dnf complains about the GPG key, accept it after checking the fingerprint matches the vendor's published key.

Warning:

In March 2026 Trivy was hit by a supply chain attack. Using compromised credentials and a tampered release pipeline, the attacker published a malicious v0.69.4 through the official deb/rpm repos, GitHub and the container registries, and separately pushed malicious 0.69.5 and 0.69.6 images to Docker Hub only. Run trivy --version and check your image tags. If you find any of those three versions, remove it, rotate every credential that host or CI runner could reach, and install a current release. In CI, pin images by digest rather than by tag.

Now scan the root filesystem for high and critical CVEs that already have a fix available:

bash
LinuxTeck.com
sudo trivy rootfs --scanners vuln --severity HIGH,CRITICAL --ignore-unfixed /

Expected output:

OUTPUT
2026-11-24T11:20:14+05:30 INFO [vulndb] Need to update DB
2026-11-24T11:20:14+05:30 INFO [vulndb] Downloading vulnerability DB...
2026-11-24T11:20:31+05:30 INFO Detected OS family="ubuntu" version="24.04"
2026-11-24T11:20:31+05:30 INFO [ubuntu] Detecting vulnerabilities... pkg_num=712

/ (ubuntu 24.04)
Total: 2 (HIGH: 1, CRITICAL: 1)

Library Vulnerability Severity Status Installed Version Fixed Version
openssh-server CVE-2024-6387 HIGH fixed 1:9.6p1-3ubuntu13 1:9.6p1-3ubuntu13.3
sudo CVE-2025-32463 CRITICAL fixed 1.9.15p5-3ubuntu5 1.9.15p5-3ubuntu5.24.04.1

This sample came from a deliberately unpatched test VM. Notice Trivy compares against Ubuntu's own fixed versions, so it does not repeat the backport false positive Nmap showed. --ignore-unfixed hides CVEs with no patch yet, which keeps the report actionable. Fix both with a normal apt upgrade or dnf upgrade.

If you see TOOMANYREQUESTS while the DB downloads, you are on an older Trivy build or behind a busy shared NAT. Upgrade Trivy first, since current releases already try mirror.gcr.io before ghcr.io. If you override --db-repository, list both mirrors, because the flag replaces the defaults.

Step 7 - Turn Lynis Findings into a Fix List (Intermediate)

The scrolling Lynis output is hard to act on. The report file is not. This step shows how to extract only what needs fixing, then dig into a single test to see the exact setting it wants. Commands are identical on Ubuntu and RHEL/Rocky.

Pull every warning and suggestion out of the machine-readable report:

bash
LinuxTeck.com
sudo grep -E "^(warning|suggestion)\[\]" /var/log/lynis-report.dat | cut -d"|" -f1,2 | head -8

Expected output:

OUTPUT
warning[]=PKGS-7392|Found one or more vulnerable packages.
warning[]=FIRE-4512|iptables module(s) loaded, but no rules active
suggestion[]=SSH-7408|Consider hardening SSH configuration
suggestion[]=AUTH-9230|Configure password hashing rounds in /etc/login.defs
suggestion[]=KRNL-6000|One or more sysctl values differ from the scan profile and could be tweaked
suggestion[]=HRDN-7230|Harden the system by installing at least one malware scanner
suggestion[]=FILE-6310|To decrease the impact of a full /home file system, place /home on a separate partition
suggestion[]=BANN-7126|Add a legal banner to /etc/issue, to warn unauthorized users

Each line starts with a test ID. Warnings come first in priority. PKGS-7392 means outdated packages with known CVEs, which Step 6 already covered in detail. Drill into any single test like this:

bash
LinuxTeck.com
sudo lynis show details SSH-7408

Expected output:

OUTPUT
2026-11-24 11:31:08 Performing test ID SSH-7408 (Check SSH specific defined options)
2026-11-24 11:31:08 Result: Option AllowTcpForwarding found
2026-11-24 11:31:08 Result: OpenSSH option AllowTcpForwarding is in a weak configuration state and should be fixed
2026-11-24 11:31:08 Suggestion: Consider hardening SSH configuration [test:SSH-7408] [details:AllowTcpForwarding (set YES to NO)]
2026-11-24 11:31:08 Result: OpenSSH option MaxAuthTries is in a weak configuration state and should be fixed

Now you know exactly which sshd options to change. Work through the list, re-run the audit and watch the hardening index climb. Our Linux server hardening checklist maps most Lynis suggestions to concrete fixes.

Step 8 - Run a CIS Compliance Scan with OpenSCAP (Real-World)

When an auditor asks "are your servers CIS compliant?", OpenSCAP gives you a dated, rule-by-rule answer. This is the compliance scanning step that most quick tool lists skip entirely.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install openscap-scanner scap-security-guide -y
ls /usr/share/xml/scap/ssg/content/ | grep ds.xml

Expected output:

OUTPUT
Installed:
openscap-scanner-1.3.10-2.el9.x86_64
scap-security-guide-0.1.76-1.el9.noarch

Complete!
ssg-rl9-ds.xml

Rocky ships its content as ssg-rl9-ds.xml (or ssg-rl10-ds.xml on Rocky 10). On RHEL you will see ssg-rhel9-ds.xml instead, use whichever file exists.

Run a CIS Level 1 server evaluation and generate an HTML report:

bash
LinuxTeck.com
sudo oscap xccdf eval --profile xccdf_org.ssgproject.content_profile_cis_server_l1 --results /root/cis-results.xml --report /root/cis-report.html /usr/share/xml/scap/ssg/content/ssg-rl9-ds.xml

Expected output:

OUTPUT
Title Ensure /tmp Located On Separate Partition
Rule xccdf_org.ssgproject.content_rule_partition_for_tmp
Result fail

Title Disable SSH Root Login
Rule xccdf_org.ssgproject.content_rule_sshd_disable_root_login
Result pass

Title Ensure auditd Collects Information on Kernel Module Loading
Rule xccdf_org.ssgproject.content_rule_audit_rules_kernel_module_loading
Result fail

Open /root/cis-report.html in a browser for the full scorecard with remediation text. oscap exits with code 2 whenever any rule fails or returns unknown, so do not treat that as a crash in scripts. Some rules like separate partitions cannot be fixed on a running server, document them as accepted risk.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo pro enable usg
sudo apt install usg -y
sudo usg audit cis_level1_server

Expected output:

OUTPUT
One moment, checking your subscription first
Ubuntu Security Guide enabled
...
Wrote XML output to /var/lib/usg/usg-results-20261124.1145.xml
Wrote HTML output to /var/lib/usg/usg-report-20261124.1145.html

On Ubuntu the supported CIS content comes through the Ubuntu Security Guide, which needs an Ubuntu Pro subscription (free for up to 5 machines on a personal account). If pro enable usg fails, attach the machine first with sudo pro attach.

Step 9 - Catch Silent Tampering with AIDE File Integrity Monitoring (Real-World)

Signature scanners only find known threats. AIDE finds anything that changed: a replaced binary, a new SUID file, an edited sudoers line. It is the closest thing to a tripwire you can get for free.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt install aide -y
sudo aideinit -y -f

Expected output:

OUTPUT
Running aide --init...
Start timestamp: 2026-11-24 12:01:44 +0530 (AIDE 0.18.6)
AIDE initialized database at /var/lib/aide/aide.db.new
Number of entries: 214367

aideinit builds the baseline and copies it into place for you. Without -y -f it stops at an interactive Overwrite existing /var/lib/aide/aide.db [Yn]? prompt, which hangs any script or Ansible run. Expect 3 to 10 minutes on a typical server. The entry count shows how many files are now tracked.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf install aide -y
sudo aide --init
sudo mv /var/lib/aide/aide.db.new.gz /var/lib/aide/aide.db.gz

Expected output:

OUTPUT
Start timestamp: 2026-11-24 12:03:52 +0530 (AIDE 0.19.2)
AIDE initialized database at /var/lib/aide/aide.db.new.gz

Number of entries: 98320

Rocky and RHEL 9.8 rebased AIDE from 0.16 to 0.19.2, so older 9.x minor releases still show AIDE, version 0.16 here. On RHEL-family systems you move the new database into place yourself. Forget the mv and the next check fails with Couldn't open file /var/lib/aide/aide.db.gz for reading. If you are upgrading an existing 0.16 setup with a customised config, run sudo aide-migrate-config first, because 0.19 changed the config syntax.

Later, after a suspected incident or on a schedule, compare the system to that baseline:

bash
LinuxTeck.com
sudo aide --check --config /etc/aide/aide.conf # Ubuntu path; on Rocky just run: sudo aide --check

Expected output:

OUTPUT
Start timestamp: 2026-11-24 12:40:11 +0530 (AIDE 0.18.6)
AIDE found differences between database and filesystem!!

Summary:
Total number of entries: 214368
Added entries: 1
Removed entries: 0
Changed entries: 2

---------------------------------------------------
Added entries:
---------------------------------------------------
f++++++++++++++++: /usr/local/bin/.sysd

---------------------------------------------------
Changed entries:
---------------------------------------------------
f ... .C... : /etc/passwd
f ... .C... : /etc/shadow

This is what a bad day looks like. A hidden binary in /usr/local/bin plus changes to passwd and shadow nobody can explain means a new user was added and something was planted. A clean check prints AIDE found NO differences between database and filesystem. Looks okay!!. Keep a copy of the baseline database off the server, an attacker with root can rewrite the local one.

Step 10 - Automate Your Linux Scanning Tools with a systemd Timer (Real-World)

A scanner you have to remember to run is a scanner you will stop running. This bundle runs Lynis, rkhunter, ClamAV and AIDE every Sunday at low priority and raises a syslog alert only when something is off.

Save this as /usr/local/sbin/weekly-scan.sh. It runs four scanners at low priority, logs everything, and writes an alert to syslog only when something needs a human:

bash
LinuxTeck.com
#!/bin/bash
# weekly-scan.sh - LinuxTeck host scan bundle
set -u
LOGDIR="/var/log/secscan"
STAMP=$(date +%F)
mkdir -p "$LOGDIR"

# Lowest CPU and disk priority so production traffic always wins
# (a Bash array keeps each word a separate argument)
NICE=(nice -n 19 ionice -c3)

"${NICE[@]}" lynis audit system --cronjob --quiet > "$LOGDIR/lynis-$STAMP.log" 2>&1
"${NICE[@]}" rkhunter --check --cronjob --report-warnings-only > "$LOGDIR/rkhunter-$STAMP.log" 2>&1
"${NICE[@]}" clamscan -r -i --exclude-dir="^/(proc|sys|dev|run)" /home /var/www /tmp > "$LOGDIR/clamav-$STAMP.log" 2>&1
CLAM_RC=$?
# On RHEL/Rocky drop the --config flag
"${NICE[@]}" aide --check --config /etc/aide/aide.conf > "$LOGDIR/aide-$STAMP.log" 2>&1
AIDE_RC=$?

HI=$(grep -oP 'hardening_index=\K[0-9]+' /var/log/lynis-report.dat 2>/dev/null || echo "NA")
echo "$STAMP hardening=$HI clamav_rc=$CLAM_RC aide_rc=$AIDE_RC" >> "$LOGDIR/summary.log"

if [ "$CLAM_RC" -eq 1 ] || [ "$AIDE_RC" -ne 0 ]; then
echo "ALERT: review $LOGDIR/*-$STAMP.log" | logger -t secscan -p auth.warning
exit 1
fi
exit 0

Make it executable with sudo chmod 700 /usr/local/sbin/weekly-scan.sh and do one manual run with sudo /usr/local/sbin/weekly-scan.sh; tail -1 /var/log/secscan/summary.log.

Expected output:

OUTPUT
2026-11-24 hardening=71 clamav_rc=0 aide_rc=0

Zero for both return codes means no malware and no file changes. ClamAV returns 1 when it finds something and 2 on errors, AIDE returns a non-zero value for any difference. The hardening value lets you track progress week over week.

Now schedule it with a systemd timer instead of cron, so missed runs catch up after a reboot. Our cron to systemd timers guide covers the syntax in depth:

bash
LinuxTeck.com
sudo tee /etc/systemd/system/weekly-scan.service > /dev/null << 'EOF'
[Unit]
Description=Weekly LinuxTeck security scan

[Service]
Type=oneshot
ExecStart=/usr/local/sbin/weekly-scan.sh
EOF

sudo tee /etc/systemd/system/weekly-scan.timer > /dev/null << 'EOF'
[Unit]
Description=Run weekly security scan

[Timer]
OnCalendar=Sun *-*-* 02:30:00
RandomizedDelaySec=30m
Persistent=true

[Install]
WantedBy=timers.target
EOF

sudo systemctl daemon-reload
sudo systemctl enable --now weekly-scan.timer
systemctl list-timers weekly-scan.timer

Expected output:

OUTPUT
NEXT LEFT LAST PASSED UNIT ACTIVATES
Sun 2026-11-29 02:47:12 IST 4 days left - - weekly-scan.timer weekly-scan.service

1 timers listed.

The timer is armed for Sunday at 02:30 plus up to 30 minutes of random delay, which stops 50 servers from hammering storage at the same second. Persistent=true means a server that was off on Sunday runs the scan at next boot. Ship the secscan syslog tag to your central log server so alerts do not die on the host, the Linux logging best practices guide shows how.

Step 11 - The Baseline Mistake That Hides a Compromise (Mistake)

This is the most common way teams accidentally erase evidence of a breach. It happens with rkhunter and AIDE alike, usually at 2 AM after a noisy alert.

Here is the scenario. rkhunter flags that /usr/bin/ps has changed. The admin assumes it was a package update and runs this to make the warning go away:

bash
LinuxTeck.com
# WRONG: re-baselining before checking why the file changed
sudo rkhunter --propupd

Expected output:

OUTPUT
[ Rootkit Hunter version 1.4.6 ]
File updated: searched for 177 files, found 141

The warning disappears, and so does the evidence. If that ps binary was trojaned, rkhunter now treats the trojaned version as the trusted baseline and will never complain about it again.

Critical:

Never run rkhunter --propupd (or re-init AIDE) to silence a warning you have not explained. First verify the changed files against the package manager, which keeps its own signed checksums. Only re-baseline after you have confirmed the change came from a legitimate update.

The correct fix is to ask the package manager whether the binary matches what it installed:

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo apt install debsums -y
sudo debsums -s procps

Expected output:

OUTPUT
debsums: changed file /usr/bin/ps (from procps package)

-s reports only mismatches. A changed file from a package you did not update is a red flag. Isolate the host and reinstall from trusted media rather than trusting anything on disk.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo rpm -Vf /usr/bin/ps

Expected output:

OUTPUT
S.5....T. /usr/bin/ps

S means size changed, 5 means the checksum changed, T means the timestamp changed. A binary (not a config file marked c) with a changed checksum is exactly what a rootkit leaves behind. No output at all means the file matches the RPM database and it is safe to run --propupd.

If the verification comes back dirty, treat the server as compromised. Our Linux ransomware protection guide covers isolation and recovery steps that apply to any intrusion.

Step 12 - Confirm Patches Actually Took Effect (Real-World)

This is the step most scanning guides skip. A clean CVE report means nothing if the old OpenSSL is still loaded in memory by a process that started three months ago.

Scanners tell you what is vulnerable. Your distro's own tools tell you whether the fix is installed, and whether the running system is actually using it. An updated library does nothing until the processes using it restart.

On Ubuntu/Debian:

bash
LinuxTeck.com
sudo pro fix CVE-2024-6387

Expected output:

OUTPUT
CVE-2024-6387: OpenSSH vulnerability
- https://ubuntu.com/security/CVE-2024-6387

1 affected source package is installed: openssh
(1/1) openssh:
A fix is available in Ubuntu standard updates.
The update is already installed.

✔ CVE-2024-6387 is resolved.

pro fix checks Ubuntu's own security data, so it answers the backport question from Step 5 in one command. It works without an Ubuntu Pro subscription for fixes in the standard archive. If it says the update is not installed, it offers to apply it for you.

Next, find services still running old code after an upgrade:

bash
LinuxTeck.com
sudo needrestart -r l

Expected output:

OUTPUT
Scanning processes...
Scanning candidates...
Scanning linux images...

Running kernel seems to be up-to-date.

Services to be restarted:
systemctl restart ssh.service
systemctl restart nginx.service

-r l lists services without restarting anything, which is what you want on production. Schedule the restarts in your maintenance window. If the kernel line says a newer kernel is pending, the box needs a reboot before the kernel fix counts.

On RHEL/Rocky Linux:

bash
LinuxTeck.com
sudo dnf updateinfo list --security

Expected output:

OUTPUT
Last metadata expiration check: 0:12:41 ago on Tue 24 Nov 2026 12:51:03 PM IST.
RLSA-2026:8812 Important/Sec. openssl-1:3.2.2-6.el9_7.2.x86_64
RLSA-2026:8790 Moderate/Sec. libxml2-2.9.13-12.el9_7.1.x86_64

Each line is a security advisory with a pending fix. Empty output means every security update is installed. Apply them with sudo dnf upgrade --security. For automated CVE checks against Rocky's published OVAL data, OpenSCAP's oscap oval eval works the same way as Step 8.

Then check whether a reboot or restart is needed:

bash
LinuxTeck.com
sudo dnf install dnf-utils -y
sudo needs-restarting -r

Expected output:

OUTPUT
Core libraries or services have been updated since boot-up:
* kernel
* openssl-libs

Reboot is required to fully utilize these updates.
More information: https://access.redhat.com/solutions/27943

Exit code 1 here means a reboot is needed, which makes it easy to wire into the Step 10 script or an Ansible play. Run sudo needs-restarting -s to list individual services instead.

Common Errors and Fixes

clamscan dies with Killed and dmesg shows Out of memory: Killed process 4121 (clamscan). The box has less than about 2 GB of free RAM for the signature database. Add a 2 GB swap file, scan smaller directory sets, or run clamdscan against a single long-running clamd so signatures load once instead of on every scan.

Trivy fails with TOOMANYREQUESTS or failed to download vulnerability DB. Shared IPs on CI runners and NAT gateways hit registry rate limits, especially on older Trivy builds. Upgrade Trivy, list fallback mirrors if you set --db-repository, or cache the DB once with trivy image --download-db-only and run later scans with --skip-db-update.

Your CI pipeline marks the OpenSCAP job as failed every time. oscap returns 2 when any rule fails or returns unknown, not only on real errors. Treat exit code 1 as an actual failure and parse the results XML for a pass percentage threshold instead of trusting the raw exit code.

rkhunter floods you with Warning: The file properties have changed after every patch day. That is expected, the binaries really did change. Verify with debsums -s or rpm -Va first, then run rkhunter --propupd. On Debian-based systems, setting APT_AUTOGEN="true" in /etc/default/rkhunter refreshes the baseline automatically after apt runs.

What to Do When a Scan Finds Something Real

Say ClamAV flags a PHP file in an upload folder, or AIDE shows a new binary nobody installed. Do not delete it and move on. This order keeps evidence and stops the bleeding:

  1. Isolate first. Pull the host from the load balancer or block outbound traffic with the firewall, but keep it running so memory evidence survives.
  2. Copy the evidence. Hash and copy the file with sha256sum and cp -a to a separate host before touching anything.
  3. Find how it got there. Check web server access logs around the file's timestamp (stat shows it) for the upload request and the IP behind it.
  4. Check for persistence. Review crontab -l for every user, systemctl list-timers, new users in /etc/passwd and ~/.ssh/authorized_keys files.
  5. Rebuild, do not clean. If anything ran as root, rebuild from a known good image and restore data from a backup taken before the earliest suspicious timestamp.
Scan Cadence and Maintenance Checklist

Running scanners once is a project. Running them on a rhythm is security. This is the cadence I use for internet-facing production servers. Internal-only boxes can stretch each interval a little.

Daily
  • ClamAV signatures update automatically (freshclam checks 12 times a day upstream, 24 on Ubuntu's packaged config), confirm with systemctl status clamav-freshclam
  • Check journalctl -t secscan or your log server for scan alerts
  • Review failed SSH logins and new sudo usage
Weekly
  • Automated bundle from Step 10: Lynis, rkhunter, ClamAV on upload paths, AIDE check
  • trivy rootfs --severity HIGH,CRITICAL --ignore-unfixed / on every host and image
  • Patch anything with a fix available within 7 days for critical, 30 days for high
Monthly
  • OpenSCAP or USG CIS report, compare the pass rate to last month
  • Nmap full-port scan from outside your network against every public IP
  • Review the Lynis hardening index trend in summary.log, it should never drop
Quarterly
  • Authenticated OpenVAS (Greenbone) scan across the whole fleet
  • Rebuild AIDE baselines after major upgrades, stored off-host
  • Prune scanner exclusion lists and false-positive whitelists that nobody remembers adding
Questions I Get Asked About This All the Time

The Linux scanning tools questions that come up most often when people roll these scanners out on real servers.

Nmap flagged CVE-2024-6387 on my server but apt says OpenSSH is fully patched. Which one is right?

Almost always apt. Ubuntu, Debian, RHEL and Rocky backport fixes into the same upstream version number, so a banner scanner sees 8.9p1 and assumes it is vulnerable. Check the package changelog with apt changelog openssh-server | grep 6387 or rpm -q --changelog openssh-server | grep 6387. If the CVE is listed, you are patched.

Can I run ClamAV on a 1 GB VPS without it getting killed?

Not reliably with clamscan, since each run loads the full signature set into memory. Add at least 2 GB of swap, scan one directory at a time, and run with nice -n 19. If you only need to check uploads, a better option is scanning files at upload time from your application instead of full sweeps.

Should I run rkhunter --propupd after every apt or dnf upgrade?

Yes, but only after verifying the changes came from the package manager. Run debsums -s or rpm -Va first, then propupd. On Debian and Ubuntu, APT_AUTOGEN="true" automates this safely because it runs right after apt finishes.

My Lynis hardening index is 62. What score should I aim for?

There is no official pass mark. Most hardened production servers I manage sit between 75 and 85. Chasing 100 usually means disabling things you need. Track the trend instead, and make sure no change ever drops the score without a reason.

Is it safe to run these scanners on a busy production database server?

Lynis, Trivy and chkrootkit are light. ClamAV and AIDE read every file and can spike disk I/O. Wrap them in nice -n 19 ionice -c3 like the Step 10 script does and schedule them outside peak hours. Never run an unauthenticated OpenVAS full scan against a production database during business hours, some checks can crash fragile services.

Do I still need OpenVAS if I already run Lynis and Trivy?

For a handful of servers, probably not. Lynis and Trivy cover configuration and package CVEs on each host. OpenVAS earns its 4 vCPU and 8 GB RAM when you need one central view across dozens of hosts, network devices and appliances you cannot install agents on.

Is a free vulnerability scanner good enough, or do I need a commercial vulnerability management platform?

For up to a few dozen Linux servers, the open source stack in this guide covers scanning, compliance and tampering detection well. Commercial platforms like Nessus or Wazuh's hosted offering earn their cost when you need asset inventory, ticketing integration, SBOM tracking for your own software, and one dashboard for auditors across hundreds of hosts. Start free, and pay only when the reporting and triage work starts eating your week.

How do I stop a vulnerable container image from reaching production?

Add trivy image --exit-code 1 --severity CRITICAL --ignore-unfixed myapp:latest as a CI step before the push. A non-zero exit code fails the pipeline, so the image never gets deployed until someone rebuilds it on a patched base.

Conclusion

You now have a layered scanning setup: Lynis for the Linux security audit, Nmap and Trivy for vulnerability scanning, ClamAV, rkhunter and chkrootkit for malware and rootkits, AIDE for tampering, and OpenSCAP for compliance. None of them is perfect alone. Together they leave very few places to hide.

Do one thing today. Install Lynis on your most exposed server, run sudo lynis audit system, and fix the first three warnings. Then set up AIDE so you have a clean baseline before you ever need it.

Have you caught something real with one of these tools, or burned hours on a false positive? Tell me in the comments which scanner earns its place in your stack. If this article helped, share it with your team.

LinuxTeck - 10 Proven Linux Scanning Tools to Find Hidden Threats Fast
This guide covered installing, running and automating 10 Linux scanning tools and Linux security tools on Ubuntu and RHEL/Rocky Linux, from Lynis audits to AIDE file integrity checks and CIS compliance scans.
LinuxTeck's Enterprise Linux category focuses on production-ready Linux skills including:
Linux vulnerability scanner setup, open source vulnerability scanning tools, server hardening, rootkit detection,
file integrity monitoring, CIS compliance, container security, and security automation.


☕

Support My Work

Thank you for reading and for being part of this journey. If this article saved you time, consider buying me a coffee. Every contribution helps me keep producing in-depth, practical Linux content for readers like you.

Thank you for your endless support

About Aneeshya S

Aneeshya S is a Senior Linux Trainer and System Administrator with over 10 years of experience. She actively follows emerging technologies and industry trends. Outside the terminal, she enjoys music and travel.

View all posts by Aneeshya S →

Leave a Reply

Your email address will not be published.

L