Skip to content

Instantly share code, notes, and snippets.

@justmiles
Created July 22, 2020 19:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save justmiles/6fd6a55601bcb86071611faa3f88b7d4 to your computer and use it in GitHub Desktop.
Save justmiles/6fd6a55601bcb86071611faa3f88b7d4 to your computer and use it in GitHub Desktop.
Install and configure ClamAV for Ubuntu
# Install ClamAV
sudo apt install clamav clamav-daemon moreutils
# Set reasonable timeouts for the virus database download
sudo sed -i 's/ConnectTimeout .*/ConnectTimeout 300/' /etc/clamav/freshclam.conf
sudo sed -i 's/ReceiveTimeout .*/ReceiveTimeout 300/' /etc/clamav/freshclam.conf
# Restart FreshClam
sudo systemctl restart clamav-freshclam
# Schedule a daily scan
cat << EOF > /tmp/clamav
$(which clamscan) --infected --remove --recursive /home /etc /opt /bin /usr /media /boot /lib /lib64 /root /sbin /snap /sys /tmp /var | ts '[%Y-%m-%d %H:%M:%S]' >> /var/log/clamav/clamscan.log 2>&1
EOF
chmod +x /tmp/clamav && sudo mv /tmp/clamav /etc/cron.daily/clamav
# Run your first scan (this will take a while)
sudo /etc/cron.daily/clamav
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment