Difference between revisions of "ClamAV"

Removed invalid paramter clamdscan cronjob; add creating folder 'logs' +'quarantine' + ExcludePath in clamd.conf
(Add crontab setup and formatting)
(Removed invalid paramter clamdscan cronjob; add creating folder 'logs' +'quarantine' + ExcludePath in clamd.conf)
Tags: Mobile web edit Mobile edit
Line 83: Line 83:


<syntaxhighlight lang="cron">
<syntaxhighlight lang="cron">
53 8 * * 5 /usr/bin/clamdscan --fdpass --multiscan --exclude-dir="$HOME/.clam/quarantine" --move="$HOME/.clam/quarantine" --log="$HOME/.clam/logs/$(date +\%Y\%m\%d)-weekly.log" $HOME 2>/dev/null 1>&2
53 8 * * 5 /usr/bin/clamdscan --fdpass --multiscan --move="$HOME/.clam/quarantine" --log="$HOME/.clam/logs/$(date +\%Y\%m\%d)-weekly.log" "$HOME" 2>/dev/null 1>&2
</syntaxhighlight>
</syntaxhighlight>


This scans the entire <code>$HOME</code> directory every week on Saturday at 08:53. See <code>man 5 crontab</code> for more info on the formatting of this file and <code>man clamdscan</code> for an explanation of the options used.
This scans the entire <code>$HOME</code> directory every week on Saturday at 08:53. See <code>man 5 crontab</code> for more info on the formatting of this file and <code>man clamdscan</code> for an explanation of the options used.
If not already present, the directories for <code>'logs'</code> and <code>'quarantine'</code> are to be created in the <code>$HOME</code> directory:
<code>mkdir -p ${HOME}/.clam/quarantine && mkdir -p ${HOME}/.clam/logs</code>
(Otherwise, for example, creating the logfile will fail due to missing authorization.)
To exclude scanning the <code>'quarantine'</code> folder in the <code>$HOME</code> directory, add an <code>'ExcludePath'</code> to <code>'/etc/clamav/clamd.conf'</code> with your prefered editor, for example using 'vim':
<code>sudo vim /etc/clamav/clamd.conf</code>
Search for "ExcludePath" and add:
<code>ExcludePath ^/home/.*/\.clam/quarantine</code>
Alternative: you can provide a separate config-file.
For more Information see <code>man clamdscan</code> and <code>man clamd.conf</code>.


Then run <code>sudo crontab -e -u clamav</code> to set up automatic updates. (These should be run as the <code>clamav</code> user.) Add the following line to update these at 13 past every hour:
Then run <code>sudo crontab -e -u clamav</code> to set up automatic updates. (These should be run as the <code>clamav</code> user.) Add the following line to update these at 13 past every hour:
4

edits