You're running a default example of the freshclam config file that is missing all sorts of settings.
If you run:
sudo dpkg-reconfigure clamav-freshclam
it will create a new freshclam.conf file in the /etc/clamav/
folder.
Remove the existing freshclam.conf file from the /usr/local/etc/
folder.
sudo rm -f /usr/local/etc/freshclam.conf
Then create a link to the new file so that if you ever have to run it again, the conf file stays updated.
sudo ln -s /etc/clamav/freshclam.conf /usr/local/etc/freshclam.conf
Then run freshclam to update.
sudo freshclam
You might get this error: freshclam: error while loading shared libraries: libclamav.so.7: cannot open shared object file: No such file or directory
, which can be fixed by running:
sudo apt-get install --reinstall libclamav6
Or for Ubuntu 16.04:
sudo apt-get install --reinstall libclamav7
Or, I haven't tried this one yet, but it has been said that it works on any distro:
sudo ldconfig
It seems that installing clamav via apt-get install clamav
doesn't actually install the clamav daemon; it only installs the freshclam daemon. You'll probably want to install clamav-daemon
as well. The first time clamd runs, it'll create /etc/clamav/clamd.conf
.
Note that the clamav package does install clamscan
, which you can invoke manually to scan specific files/directories. However, by default, nothing will be scanned automatically. clamav-daemon allows scans to be triggered remotely, but even that doesn't schedule scans or provide realtime protection.
This is a good reminder that you should never just install security software and forget about it. You need to make sure it's working properly. I'm sure plenty of people run sudo apt-get install clamav
, then just assume it's working in the background--when, in reality, all that's running is freshclam.
If you're actually looking for realtime protection, instead of just trying to run a scan, user61995 mentioned a potential solution. I haven't tested it.
tl;dr: sudo apt install clamav-daemon
to fix the error, but you still have to run scans manually to be protected; these packages don't provide realtime protection.
Best Answer
I seem to remember getting this issue when I first started using clamav, going back through my notes I found I had written this:
First find out my uid and gid by typing at the command prompt:
id your_username
Should give you a long line of text with a uid and gid in it somewhere, then type:
sudo chown UID.GID /var/lib/clamav
thensudo chmod 755 /var/lib/clamav
Change UID and GID with the values you got from the id Command above.
hope that helps