Dit deel is nog niet vertaald. Je ziet de Engelse tekst.
$ als gewone gebruiker# als root (of met sudo)
The quick answer
Step by step
- Run the audit as root (quick answer).
--quick= no pauses between sections. It takes 1–3 minutes and changes nothing. - Read the end of the output first:
Lynis security scan details:
Hardening index : 64 [############ ]
Tests performed : 262The index is a guide (higher = better), not a grade for an audit. The warnings and suggestions are what matter.
- List the findings with their test IDs:
grep '^warning' /var/log/lynis-report.dat
warning[]=SSH-7408|SSH option PermitRootLogin should be set to no|-|-|
grep '^suggestion' /var/log/lynis-report.dat | head
suggestion[]=AUTH-9230|Configure password hashing rounds in /etc/login.defs|-|-|
lynis show details SSH-7408- Fix in order: warnings first, then suggestions that close real risks (SSH, users, firewall, updates, logging). Typical quick wins: harden SSH, install updates, enable auditd/AIDE, set password rules, remove compilers and unused services on production servers.
- Skip what does not fit — in a custom profile, with a reason:
# USB storage is needed on this backup server (ticket SEC-210)
skip-test=USB-1000- Track over time: run it monthly (timer/cron), keep the
hardening_indexper server in your monitoring or a spreadsheet, and compare after changes. For formal compliance (CIS, STIG, PCI) use OpenSCAP with a profile — Lynis is the fast general check.
Check that it worked
Common problems
| Problem | Cause | Fix |
|---|---|---|
lynis: command not found on RHEL | Not in the base repos. | Enable EPEL, or run it from the Git download. |
| Old checks / version warning | The distro package is old. | Use the current version from the Lynis repo or Git. |
| Findings that do not apply | General checks vs your server's role. | skip-test in a custom profile with a reason. |
| A "fix" broke the app | Hardening without testing (for example removing a needed package). | Test on staging; change one thing at a time. |
| Different scores on similar servers | Different packages or settings (drift). | Use Ansible roles so servers are the same. |
| Auditor asks for a specific standard | Lynis is not a CIS report. | OpenSCAP with the CIS/STIG profile for formal reports. |
Go further
- Command pages: lynis, oscap.
- Next how-tos: Harden the SSH server, Set password rules and expiry, Check file integrity with AIDE, Patch a server with security updates, Scan a server for compliance with OpenSCAP.
- Full guides: Lynis, OpenSCAP. At work: Lynis in host security.
1Where does Lynis write the machine-readable results?
In /var/log/lynis-report.dat (warnings, suggestions, hardening index).
2How do you tell Lynis to skip a test that does not fit your server?
Add skip-test=TEST-ID with a reason in a custom profile (/etc/lynis/custom.prf).