heihachi88
6/10/2015 - 9:30 AM

Install CLAMAV

Install CLAMAV

apt-get install clamav clamav-daemon

# everything on default
dpkg-reconfigure clamav-base

# update virus base
freshclam

# start clamav
service clamav-daemon start

# scan dirs 
clamdscan /home/ /etc/ /var/www/ --infected --multiscan --fdpass


===
–infected – Only print infected files. (clamd)

–multiscan – In the multiscan mode clamd will attempt to scan the directory contents in parallel using available threads. This option is especially useful on multiprocessor and multi-core  systems. If you pass more than one file or directory in the command line, they are put in a queue and sent  to  clamd  individually. This means, that single files are always scanned by a single thread.  Similarly, clamdscan will wait for clamd to finish a directory scan  (performed in multiscan mode) before sending request to scan  another  directory. This option can be combined with –fdpass (see below). (clamdscan)

–fdpass – Pass the file descriptor permissions to clamd. This is useful if clamd is running as a different user as it is faster than streaming the file to clamd. Only available if connected to clamd via local(unix) socket. (clamdscan)
#!/bin/sh
freshclam --quiet
rm -R /root/nightly-clamav-scan.log
touch /root/nightly-clamav-scan.log
clamdscan /home/ /etc/ /srv/www/ --infected --multiscan --fdpass --log=/root/nightly-clamav-scan.log