Make your Nextcloud more secure using clamav and Nextcloud’s file-antivirus app. Just install clamav on your server (Ubuntu 16.04 LTS) and make few configuration steps.
Install clamav using the Ubuntu repositories
sudo -s apt update && apt upgrade -y apt install clamav clamav-freshclam clamav-daemon -y
service clamav-freshclam stop freshclam
service clamav-freshclam start
Change some values in clamav config:
Save and quit the configuration file, restart freshclam
service clamav-freshclam restart && service clamav-daemon restart
Clamav will be updated every hour (using freshclam), you do not have to configure anything.
Install Nextcloud’s file_antivirus app
Change to Nextclouds app-directory
and download the current antivirus app:
Extract the app and set the permissions to the webuser:
unzip master && mv files_antivirus-master files_antivirus && rm master.zip chown -R www-data:www-data /var/www/nextcloud
Now logon to your Nextcloud and enable the antivirus app:
Change to the admin panel and select “Additional settings” -> “Antivirus Configuration”. Adjust the configuration to “Daemon (Socket)” and change the “Stream Length” value to “52428800” (50MB).
Please decide wether to raise a logentry or delete infected files directly if viruses are identified.
Please find more information here.
If you upload an examplarily file you will find an entry in your Nextcloud logfile like this:
If you find “Debug files_antivirus Response :: stream: OK ” your Nextcloud is now more secure using clamav!
Enjoy your Nextcloud!