Setup Clamav Virus scan and updates – Ubuntu 14.04 LTS

Step 1. Install and update Clamav

Enter these commands in your terminal to install Clamav, daemon and Freshclam

Run Freshclam to update the virus database

Start the clamb daemon

Step 2. Automatic virus database update

It is of course essential to update the virus database and if your just a little like me could there be a chance that you would forget it. I will recommend to make a cron job there is running once every day so you have always will have a updated virus database

The easiest way to get this done is to add this line in your crontab, so open your crontab

You can choose witch text editor you want to use within the nr 1-4 and then press enter and add the content below to the file.
the virus database would get updated every day at 3:30 AM. you can edit the numbers so the cron will be executed when you want it

Step 3. automatic Virus scan

We can easily setup a daily or hourly scan. we are going to create a cron job for this, you can use your favorite text editor i am going to use nano as it is mine. we are going to open /etc/cron.hourly/manual_clamscan and you can replace houry with daily with you only want the scan to perform once a day or every hour that’s up to your.

Add the content below and remember to insert your email and witch directory you want to be scanned. if you choose aggresive 1 then will the infected file be deleted automatically but if you choose aggressive 0 will the file not be deleted but get a mail instead. You will only get mail when there is infected files.

Remember to make the cron job executiable

Step 4. Start Clamscan Manually

The -r flag in the command is important because otherwise Clam would simply scan any files within the user folder, and not in all the sub-folders.
clamscan -r /home/user