YUM在線安裝
yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y
更新病毒庫
freshclam --verbose #在線升級病毒庫 cd /usr/local/clamav/update wget http://db.local.clamav.net/daily.cvd wget http://db.local.clamav.net/main.cvd wget http://db.local.clamav.net/bytecode.cvd #手動下載病毒庫文件 rm /var/lib/clamav/mirrors.dat freshclam #“Update failed. Your network may be down or none of the mirrors listed in freshclam.conf is working” #刪除掉舊的鏡像地址文件,再手動更新一次病毒庫
掃描被感染文件
clamscan -r /etc/ >/tmp/etc.log #掃描配置目錄並將日志保存到home下 clamscan -r --bell -i / >/tmp/all.log #全盤掃描顯示有問題的結果,bell參數關閉屏顯 grep Infected /tmp/all.log #查看被感染文件數量 grep -i found /tmp/all.log #查看被感染的文件
以上圖片顯示redis被感染,需要刪除被感染文件。
啟用自動更新病毒庫
sed -i '$d' /etc/sysconfig/freshclam #默認禁止自動更新,因此去除最后一行 tail -1 /etc/cron.d/clamav-update #查看自動更新計划任務
修改配置,開啟服務
sed -i -e "s/^Example/#Example/" /etc/freshclam.conf sed -i -e "s/^Example/#Example/" /etc/freshclam.conf sed -i -e "s/^Example/#Example/" /etc/freshclam.conf sed -i -e "s/^Example/#Example/" /etc/freshclam.conf sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf echo 'LocalSocket /var/run/clamd.scan/clamd.sock' >> /etc/clamd.d/scan.conf #替換和追加配置 systemctl enable clamd@scan systemctl start clamd@scan #激活開機啟動,啟動服務
virscan 單文件病毒檢測
[http://r.virscan.org](http://r.virscan.org "http://r.virscan.org")