CentOS7安装ClamAV
虽然linux的病毒很少,如果非常注重安全的话,可以去安装个病毒扫描程序clamav
安装
yum install epel-release -y yum install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd -y
修改配置
cp /etc/clamd.d/scan.conf /etc/clamd.d/scan.conf.backup sed -i -e "s/^Example/#Example/" /etc/clamd.d/scan.conf vim /etc/clamd.d/scan.conf 找到第96行#LocalSocket /var/run/clamd.scan/clamd.sock 改为LocalSocket /var/run/clamd.scan/clamd.sock
更新
cp /etc/freshclam.conf /etc/freshclam.conf.bakup sed -i -e "s/^Example/#Example/" /etc/freshclam.conf freshclam ls -l /var/lib/clamav/
设置自定义更新时间
#一天更新两次,第一次凌晨1点,然后第二次在下午1点 crontab -e 添加 00 01,13 * * * /usr/bin/freshclam --quiet vim /usr/lib/systemd/system/freshclam.service 添加 [Unit] Description = freshclam scanner After = network.target [Service] Type = forking ExecStart = /usr/bin/freshclam -d -c 2 Restart = on-failure PrivateTmp = true [Install] WantedBy=multi-user.target systemctl start freshclam && systemctl enable freshclam && systemctl status freshclam
将扫描注册为服务
systemctl enable clamd@scan && systemctl start clamd@scan && systemctl status clamd@scan
手动扫描/home和/root目录
clamscan --infected --remove --recursive /home /root
下载测试病毒并扫描
wget http://www.eicar.org/download/eicar_com.zip clamscan --infected --remove --recursive . #全盘扫描clamscan --infected --recursive --exclude-dir="^/sys" /
日常使用最好不要使用--remove参数,推荐检测到病毒后,手工进行处理
本站所有文章均可随意转载,转载时请保留原文链接及作者。