Find us on social media
VulnerabilitiesLynisNmap5 min read
Scan your server for vulnerabilities
Lynis audit, Nmap port scanning, ClamAV antivirus and rkhunter rootkit detection.
Audit with Lynis
Lynis is a security auditing tool for Linux systems:
bash
sudo apt install -y lynis
sudo lynis audit systemThe report shows:
- Hardening score (0-100)
- Warnings (critical issues)
- Suggestions (recommended improvements)
Review the full report:
bash
sudo cat /var/log/lynis-report.datRun Lynis monthly and aim for a score above 80.
Port scanning with Nmap
Nmap identifies open ports and exposed services:
bash
sudo apt install -y nmap
# Basic port scan
nmap -sV your-server-ip
# Full scan (all ports)
nmap -sV -p- your-server-ip
# Vulnerability scan
nmap --script vuln your-server-ipClose any port you don't need open.
Antivirus with ClamAV
bash
sudo apt install -y clamav clamav-daemon
sudo systemctl stop clamav-freshclam
sudo freshclam
sudo systemctl start clamav-freshclamScan directories:
bash
# Scan home directory
sudo clamscan -r /home --infected --log=/var/log/clamav-scan.log
# Full system scan
sudo clamscan -r / --exclude-dir=/sys --exclude-dir=/proc --infectedRootkit detection with rkhunter
bash
sudo apt install -y rkhunter
sudo rkhunter --update
sudo rkhunter --check --skip-keypressReview the log:
bash
sudo cat /var/log/rkhunter.log | grep WarningAutomated scanning
Create a weekly scan script:
bash
#!/bin/bash
# /usr/local/bin/security-scan.sh
echo "=== Security Scan $(date) ==="
lynis audit system --quick 2>/dev/null | tail -5
freshclam --quiet
clamscan -r /home --infected --quiet
rkhunter --check --skip-keypress --quiet
echo "=== Scan complete ==="bash
chmod +x /usr/local/bin/security-scan.shAdd to cron (Sundays at 3 AM):
bash
0 3 * * 0 /usr/local/bin/security-scan.sh | mail -s "Security Scan Report" your-email@example.comRecommendations
- Run Lynis after every major configuration change
- Scan ports from outside the server to see what an attacker sees
- Keep ClamAV databases updated
- Investigate every rkhunter warning (may be false positives)
- Automate scans and review reports weekly
Was this guide helpful?