In this article I’m going to discuss about viruses in Linux and when you need an antivirus and when you don’t.

First idea about this could be: what do you understand for computer virus?

  • A computer program that, when executed, modifies other programs by inserting its own code.
  • A website that imitates the looking of other website in order to cheat users and getting secret info like passwords, credit card numbers, etc. This is called “phising”.

Traditional computer viruses

First type of viruses are mainly designed for Windows, due to their bigger market share. The following table shows operating system market share in August 2021 (source).

Operating system Market Share
Windows 30.66%
Linux 0.98%
OS X 6.5%

However, there are some viruses that can infect Windows and Linux computers (because they are designed in Java or Javascript, for example), so you need to be careful when browsing.

Linux is considered to be more secure than Windows for several reasons:

  • Their permissions system prevents a virus program to affect system files if it doesn’t have proper permissions to do it. If you execute a script as a non-root user and you don’t use “sudo”, that script will only be able to modify user’s files.
  • Linux kernel and most programs are open-source and community-driven, so vulnerabilities can be quickly detected and fixed.
  • Linux distros usually have package managers where you can download programs from an official repository. Those programs are checked before being uploaded to the repository. Windows has an official Store, but most programs are usually downloaded from websites.

Phising

This type of “virus” doesn’t depend on the operating system, so you need to be sure if webpage is legitimate and not a “clone” (checking URL, accessing login page only from the main page and not from a mail link, etc.)

Summary

Do you need an antivirus for your Linux computer? Probably not if you are running a desktop computer. But if you are operating a Linux server that shares files between Windows and Linux users, or you have a mail server that Windows users can use, It would be highly recommended that you install an antivirus to protect those Windows users.