ClamAV is the most widely-used open-source antivirus for Linux servers — especially important for web servers that receive user uploads.
Install and Update
sudo apt install clamav clamav-daemon -y
sudo systemctl stop clamav-freshclam
sudo freshclam
sudo systemctl start clamav-freshclam clamav-daemon
Manual Scan
clamscan -r /var/www --infected --remove --log=/var/log/clamav/scan.log
Automated Daily Scanning
#!/bin/bash
LOG=/var/log/clamav/daily-$(date +%Y%m%d).log
clamscan -r /var/www --infected --log=$LOG --quiet
INFECTED=$(grep "Infected files:" $LOG | awk '{print $3}')
if [ "$INFECTED" != "0" ]; then
mail -s "ClamAV: $INFECTED infected on $(hostname)" [email protected] < $LOG
fi
Conclusion
ClamAV provides essential malware protection for web servers. Our team configures complete server security including antivirus scanning.
Comments