Contents
Lynis is an auditing tool for Linux and other Unix-like servers. It checks the configuration and gives you warnings and suggestions for hardening. You run it directly on the server you want to check. According to the official site, it is open source and has been around since 2007. Many of its tests are written in shell script.
This review is for people who manage their own Linux servers. After reading it, you can do the following:
- Run Lynis on your own server and read its warnings and suggestions
- Know what traffic it sends outside and how to turn it off
- Skip tests you don’t need and run the same audit again on a schedule
What Lynis does
Lynis runs hundreds of tests against the system’s configuration. According to the official description, its main goal is to test your defenses and suggest ways to harden the system. It also collects general system information and looks for vulnerable packages and configuration problems.
Tests are grouped into categories. The official list includes SSH, authentication, firewall, kernel, logging, file systems, containers, malware, web services, and databases. Each test has an ID such as KRNL-6000.
Lynis scans “opportunistically”. It tests only the tools and settings it finds, so you don’t need to install other tools. If it finds Apache, for example, it adds Apache tests. Each server gets a different audit.
Results go to three places.
| Output | Contents |
|---|---|
| Screen | The result of each test. Warnings and suggestions are grouped at the end |
Log (default /var/log/lynis.log) |
What each test did, why a test failed or was skipped, and hints for fixing it. Overwritten on every scan |
Report (default /var/log/lynis-report.dat) |
A record of what Lynis found, as option=value lines |
Network traffic
- Update check: During a scan, Lynis checks whether a newer version exists. In the source code, it queries the DNS TXT record of
lynis-latest-version.cisofy.comwithdig,host, ordrill. If none of the three is installed, the check is skipped. This code sends only a DNS query. - Turning the check off: Put
skip-upgrade-test=yesin your profile. - Data upload: Off by default (
upload=noindefault.prf). It runs only if you pass--uploador setupload=yesin a profile. Without a license key and an upload server, Lynis stops with an error. It usescurlover HTTPS. This feature is for Lynis Enterprise, the commercial edition from CISOfy. You don’t need it to audit your own servers. - I did not verify whether any test makes other connections. If it matters, run Lynis once in an environment with restricted traffic and watch.
Try it safely on one server
Start with one Linux machine you manage, or a virtual machine you built yourself.
-
Install Lynis. The official README recommends packages. CISOfy provides DEB and RPM packages in its own repository. Some distributions also ship Lynis, but their version may be old.
-
If you don’t use a package, you can clone the repository and run it in place. The project says no compilation or installation is needed.
git clone https://github.com/CISOfy/lynis cd lynis -
If you run it as root, change the owner of the files to root. If a regular user still owns them, Lynis warns about file permissions.
sudo chown -R 0:0 . -
Start the audit. Use
lynisif you installed a package, or./lynisfrom the cloned directory.sudo ./lynis audit systemBy default, Lynis pauses after the first section. Press
Enterto continue andCtrl+Cto stop. Add--quickto run to the end without pausing. -
Read the warnings and suggestions grouped at the end. The ID in brackets on each line, such as
[SSH-7408], is the test ID. -
To see why a test reported something, look it up by ID. The log has the same ID with the reason.
sudo lynis show details SSH-7408 -
Fix suggestions one at a time, then run the audit again and compare.
Common uses
| Goal | How |
|---|---|
| Run to the end without pausing | lynis audit system --quick |
| Fix hard-to-read colors | --no-colors or --reverse-colors |
| Don’t write a log file | --no-log |
| Switch settings | --profile <file> |
| See details of one test | lynis show details <test ID> |
| Audit a Dockerfile | lynis audit dockerfile <file> |
| Show version and update information | lynis show version, lynis update info |
You turn off tests you don’t need in a profile. The official documentation recommends copying default.prf and editing your copy.
skip-test=SSH-7408
skip-test=SSH-7408:permitrootlogin
The first line skips the whole test. The second skips one item inside the test. If you make a separate profile for each server role, such as mail server or web server, you can audit the same way every time.
If you run Lynis without root, it switches to “non-privileged mode”. Tests that need root are skipped, and some results may differ. Run server audits as root (sudo).
How it differs from Vuls
Lynis runs on the server it checks. The official site says this lets it analyze more deeply than network-based scanners such as Nessus and OpenVAS. Vuls also looks inside the server at its packages, but it looks at different things.
| Lynis | Vuls | |
|---|---|---|
| Main goal | Check configuration and suggest hardening | List known vulnerabilities (CVEs) in packages |
| Result | Warnings, suggestions, a hardening index | CVE numbers and CVSS scores |
| Where it runs | On the server being checked | On the target itself, or on another server over SSH |
Lynis also checks for vulnerable packages, but a CVE list is not its main output. To cover package vulnerabilities thoroughly, use Vuls. To find weak configuration, use Lynis. Running both is a realistic setup.
Cautions
- Audit only servers you manage or have written permission to test.
--pentestis a mode that runs without root and shows points of interest for penetration testing. Don’t use it on machines you have no permission for. - The log and report include installed packages and configuration details. They reveal how your server is built, so don’t paste them in public or leave them in shared folders.
- The log is overwritten on every scan. To keep a previous result, copy it before the next run or set up log rotation.
- If you run a cloned copy as root, check where you got it and make root the owner. The script runs with root privileges.
- Some suggestions can affect your services if applied as they are. On production servers, test them in a separate environment first.
- According to the official README, the version a distribution ships may be old. Run
lynis update infofor update information.
Read next
Sources
- Official repository READMEgithub.com/CISOfy/lynis
- License (GPL-3.0)github.com/CISOfy/lynis/blob/master/LICENSE
- Official site: Lynis introduction (supported OS, how it works, comparison)cisofy.com/lynis/
- Docs: Get Started (installation, first run, report and logging)cisofy.com/documentation/lynis/get-started/
- Docs: Suggestions and warnings, profilescisofy.com/documentation/lynis/
- Official site: Lynis security controlscisofy.com/lynis/controls/
- Source: lynis main script (privilege check, options, update check, upload conditions)github.com/CISOfy/lynis/blob/master/lynis
- Source: update check function (include/functions)github.com/CISOfy/lynis/blob/master/include/functions
- Source: profile options (include/profiles)github.com/CISOfy/lynis/blob/master/include/profiles
- Source: default profile (default.prf)github.com/CISOfy/lynis/blob/master/default.prf
- Source: data upload (include/data_upload)github.com/CISOfy/lynis/blob/master/include/data_upload
Checked on 2026-10-27
Similar tools
osquery
Impact Local onlyA tool that lets you query the state of an operating system, such as running processes, listening ports, users, and startup items, with SQL.
- Purpose
- Defense
- Type
- Command line
- Difficulty
- Intermediate
- License
- Check termsApache-2.0 OR GPL-2.0-only
- Category
- Defense and hardening / Incident response
Vuls
Impact Reaches othersAn agentless vulnerability scanner that checks the packages installed on a server and lists the ones affected by known CVEs.
- Purpose
- Defense
- Type
- Command line
- Difficulty
- Intermediate
- License
- CopyleftGPL-3.0
- Category
- Vulnerability scanning
Wazuh
Impact Local onlyA free security platform (SIEM/XDR) that collects logs, configuration, and vulnerability data from agents on your endpoints and shows it all in one dashboard.
- Purpose
- Defense
- Type
- Self-hosted server
- Difficulty
- Advanced
- License
- CopyleftGPL-2.0(一部の構成要素は Apache-2.0)
- Category
- Vulnerability scanning / Forensics