Link to home
Create AccountLog in
Avatar of Jerry L
Jerry LFlag for United States of America

asked on

Anti-Virus and Malware Protection for Linux

Ubuntu Linux 18.04.1

I need to know what is the best recommended Anti-Virus and Malware protection I can install on my Linux machine.
Please include: Free, Less Expensive, and the Best (no matter what the price), so I can make my decision.
Avatar of kenfcamp
Flag of United States of America image

Best recommended? That's subjective at best

You could take a look at ClamAV - - Free
I've been using it for years on my mail servers and to scan my servers.

Avast has a Linux offering - - Be warned though, It's 159.99 per year

I've never used their Linux protection, but Avast has never let me down with Windows protection. Worth looking at IMO
Avatar of Jerry L


Yes, it is subjective. But sometimes, that isn't a bad thing. Your suggestion was well-received. Thank you.

However, it looks like, after looking at ClamAV, I need to rephrase my question.
In order to be protected from viruses in real time, the AV software would need to be running all the time.

Is there a way to do that without using up too many resources? cron job? What do you suggest?

Also, I recently got a popup from Chrome browser that an extension was trying to install itself. In that instance, I was warned by the browser and given the option to kill it. But that may not always be the case.

How do I protect myself in real time from bad websites, or bad scripts on web pages?
I've handled machines with Kaspersky installed ( and they had no issues with running) but can't work out how you buy it
Avatar of David Favor
David Favor
Flag of United States of America image

Link to home
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
I use Linux for more than 25 years on desktops and dedicated servers, and I never got any virus, just because I keep my system up to date. In order to get that done on Ubuntu, just issue
apt-get update && apt-get -y upgrade

Open in new window

as David Favor told you above, at least once in a week.
Is there a way to do that without using up too many resources?

Well speaking in regards to ClamAV only (again I've never used the Linux solution from Avast) the base installation has minimal impact. However I do not have on-access scanning enabled because I don't need it

On-Access scanning is available however it does require your kernel to be compiled with the fanotify module version 3.8 or greater

This can be verified by running
zgrep FANOTIFY /proc/config.gz

Open in new window

On-Access scanning will likely add additional overhead equivalent to running antivirus on a Windows server.

It's best to keep in mind that everything will be scanned, so if you're running SMB or SFTP services with a 20 or 30 people transferring files, memory usage could be a potential concern.

Again, I don't use this feature so I'm not really able to give you any real insight there

David gave some really good advice that you should seriously consider.

Updates are as important if not more so than on-access scanning.

While wrapping your ports is an excellent suggestion, I would add that you should turn off any services that you don't need especially TELNET.

Telnet shouldn't be running, but if it is turn it off

The fanotify code is super old. The only way to maybe get this to work will be to compile it yourself.

Better to use inotify() or the command line tool inotifywait to fire off file scans for various actions. Usually tracking CLOSE_WRITE will be sufficient to tell you if a file has actually changed. You might also track attribute changes for evil things like when the SUID or GUID bits are set.

As Pierre said, keep your code at latest stable versions + only allow encrypted access (no clear text logins) into your machine + you'll likely be good.
The only way to maybe get this to work will be to compile it yourself.

Not always, it "should" be compiled into the kernel but the distribution (like Debian) may have it disabled.
I know Slackware-Current has it enabled, but I'm not sure about Ubuntu

In order for On-Access scanning to be performed, fanotify is needed. This includes solutions from : ClamAV, Avast, Sophros, F-Secure, and I'm sure every other solution for Linux that offers On-Access Scanning

fanotify is used for this I'm sure due to limitations in inotify
kenfcamp, you're correct fanotify() is included in most Kernels, been so long since I used it (rather than inotify) I thought it was dead. lists some command line tools which can be complied by hand to access the fanotify() API calls.

My preference is to use inotifywait as it's packaged with every major + most minor distros.

Hand built software become tough to manage in large environments, with 1000s of sites.

After reading over I now remember why I opted to stick with inotifywait at some point.

When using fanotify() be sure to read all related docs + install a very recent 4.x Kernel, to ensure you can build future proof code (that will run on all new Kernels.)
Just re-reading some notes from a project several years ago.

Both inotify + fanotify can lose events.

If you must have 100% of file system events, likely auditd will be what's required.
Avatar of Jerry L


Thank you all for your suggestions. I will need to study all this in greater detail, but it gives me some ideas.
Avatar of Jerry L


Sophos Antivirus for Linux (Free)


Startup Guide

Sophos XG Firewall Administrator Guide v15.01.0

Sophos XG Firewall Reports Guide v15.01.0

Sophos Antivirus For Linux "effectively detects and cleans viruses, Trojans, and other malware. In addition to sophisticated detection-based on advanced heuristics, Sophos Antivirus for Linux uses Live Protection to look up suspicious files in real time via SophosLabs."

"efficient on-access scanning using either the TALPA Filesystem Interceptor or the Fanotify library."

Evaluation of Different Antivirus Products