Run ClamAV as a Daemon
LocalSocketGroup root
User root
Start the clamav-daemon
systemctl start clamav-daemon
$ curl https://www.eicar.org/download/eicar.com.txt | clamdscan -
stream: Eicar-Test-Signature FOUND
For CentOS 7
Run freshclam
- Configure the freshclam to updating database
cp /etc/freshclam.conf /etc/freshclam.conf.bak
sed -i '/^Example/d' /etc/freshclam.conf
cat > /usr/lib/systemd/system/clam-freshclam.service << 'EOF'
# Run the freshclam as daemon
[Unit]
After = network.target
[Service]
Type = forking
ExecStart = /usr/bin/freshclam -d -c 4
Restart = on-failure
[Install]
WantedBy=multi-user.target
EOF
systemctl enable clam-freshclam.service
systemctl start clam-freshclam.service
cp /usr/share/clamav/template/clamd.conf /etc/clamd.conf
sed -i '/^Example/d' /etc/clamd.conf
Run Clamd
cat > /etc/init.d/clamd << 'EOF'
case "$1" in
start)
/usr/sbin/clamd
RETVAL=$?
echo
;;
stop)
echo -n "Stopping Clam AntiVirus Daemon... "
pkill clamd
rm -f /var/run/clamav/clamd.sock
rm -f /var/run/clamav/clamd.pid
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/clamd
;;
esac
EOF
chmod +x /etc/init.d/clamd
chkconfig clamd on
service clamd start
$ curl https://www.eicar.org/download/eicar.com.txt | clamdscan -