How to scan your server for malware with ClamAV
Updated 11/29/2026
ClamAV is an open-source antivirus used to scan servers, especially those receiving files from users (uploads, email attachments).
1. Install
apt-get update -y
apt-get install -y clamav clamav-daemon
2. Update the signature database
systemctl stop clamav-freshclam
freshclam
systemctl start clamav-freshclam
3. Scan a directory
clamscan -r --infected /var/www
The -r option scans recursively, --infected shows only problematic files.
4. Schedule automatic scans
Add a daily scan to cron that quarantines infected files:
0 2 * * * clamscan -r --move=/var/quarantine /var/www
Tip
Scanning uses a lot of RAM and CPU. Run it at night, during low-traffic hours. Combine with regular backups, see the backup guides, so you can restore clean if you find an infection.
Put this guide into practice on your own VPS
EU cloud servers, billed hourly, ready in minutes, with one-click installs for dozens of apps.
See pricingRelated tutorials
Single sign-on for your applications with authentik
One account for all your team's apps: first sign-in, users, an OpenID Connect application and two-factor authentication.
Updated 11/29/2026SecurityPasswordless sign-in with Pocket ID
Passkeys for your applications over OpenID Connect: first sign-in, colleagues and connecting an application.
Updated 11/29/2026SecurityHow to protect your server from brute-force attacks with fail2ban
fail2ban automatically bans IPs that repeatedly try wrong passwords. Here is how to install and configure it.
Updated 11/29/2026