guy labs guy labs

Install ClamAV antivirus in Ubuntu Server and Client

In this how to we will install ClamAV antivirus on an Ubuntu client and a server. First we will install it on the client with the following command: This will install ClamAV and the GUI frontend ClamTK. You can configure daily scans and virus definition updates inside this tool. To install ClamAV on an Ubuntu server we start by installing ClamAV and the daemon by executing the following commands: Next we need to reconfigure the ClamAV base package, update the virus definitions and start the daemon. Execute the following commands: Next we need to create a shell script which scans a specific directory and sends an email if a virus is found. Place that shell script inside the user home of the root user or somewhere else. I placed it inside /home/clamav. Ok now create a file with the command 'sudo vi' and enter the following content: Next we need to make the file executable with the following command: After that we add this file as a cronjob which executes every night at 3am: Substitute the {PATH-TO-SCRIPT} placeholder with the path where the script is stored. Next we infect the folder you want to scan with the EICAR test virus. For that create a text file and add the following content to it: Store it and then run the created to see if the virus is found and the mail is sent. After everything worked as it should, delete the test virus text file. But be aware: The script identifies the viruses and doesn't delete them, that has to be done manually. Ok...