Well, it factually is not... it's just less subject to hackers developing viruses that target Linux systems. Consumer grade computers usually run on Windows and thus, when targeting a wide audience, Windows is the way to go.
Don't misunderstand Linux and viruses, there definitely ARE Linux viruses.
Some distros have additional protection layers such as SELinux (See here) in Ubuntu for example. Then there's the default firewall and the fact that alien files don't automatically have permission to be executed. Specific execution permission has to be granted before execution is possible. (See here)
Then there are several other factors that make Linux a hard place to be for viruses usually non-root users on linux systems have no to little executable files at their disposal that would allow for viruses to stay undetected and propagate. Some programs just require you to be logged in as root (or by use of sudo) before they run or to access/modify directories other than your home. It's just a lot harder to develop a viable virus that would spread as well as it would in Windows.
UPDATE:
As mentioned below, most machines that run Linux are either servers that are run by people who know a thing or two about what they're doing. People that run Linux for desktop use usually choose to and also do know what they're doing. Almost all computer illiterate run Windows and therefore it's much easier to get those computers infected. "Hey, this machine tells me that I have I virus and I have to purchase this Anti-Virus program called 'FAKETrojanHunter' to get rid of it... Okay, let's do it!"
Because no Linux distribution/installation is equal per se, it's harder to develop malware that would infect them all as efficiently as possible. Furthermore, almost all software run on Linux is Open Source, making malware much more easily detectable since its source is open to the public.
Answer from Pylsa on Stack ExchangeWell, it factually is not... it's just less subject to hackers developing viruses that target Linux systems. Consumer grade computers usually run on Windows and thus, when targeting a wide audience, Windows is the way to go.
Don't misunderstand Linux and viruses, there definitely ARE Linux viruses.
Some distros have additional protection layers such as SELinux (See here) in Ubuntu for example. Then there's the default firewall and the fact that alien files don't automatically have permission to be executed. Specific execution permission has to be granted before execution is possible. (See here)
Then there are several other factors that make Linux a hard place to be for viruses usually non-root users on linux systems have no to little executable files at their disposal that would allow for viruses to stay undetected and propagate. Some programs just require you to be logged in as root (or by use of sudo) before they run or to access/modify directories other than your home. It's just a lot harder to develop a viable virus that would spread as well as it would in Windows.
UPDATE:
As mentioned below, most machines that run Linux are either servers that are run by people who know a thing or two about what they're doing. People that run Linux for desktop use usually choose to and also do know what they're doing. Almost all computer illiterate run Windows and therefore it's much easier to get those computers infected. "Hey, this machine tells me that I have I virus and I have to purchase this Anti-Virus program called 'FAKETrojanHunter' to get rid of it... Okay, let's do it!"
Because no Linux distribution/installation is equal per se, it's harder to develop malware that would infect them all as efficiently as possible. Furthermore, almost all software run on Linux is Open Source, making malware much more easily detectable since its source is open to the public.
One of the reasons are user privileges.
GNU/Linux systems are Unix-like systems and that means that they are built to be multi-user systems from ground up. That means that there is a strong separation of responsibilities among users. As a result, a normal user cannot actually damage the system because he doesn't have needed privileges. While there are limited accounts now available on Windows systems too, on GNU/Linux systems it is naturally expected from user to use a limited account for day today use and keep root account only for changing settings (some distributions by default won't even allow users to log as root because there are other safer mechanisms to use root account to modify settings).
On the other hand many Windows users were brought up in Windows 9x era or that era made a big influence on them. Back then only user account was administrator and everything was allowed to that user. Even today on Windows systems which are descended from multi-user Windows NT, it is often required (or at least expected) for user to use account with administrative privileges and use of limited accounts is pretty low among home users.
I mean it's open source so anyone who knows how to make them can see what linux is made of so why is it immune to malware? Do they just not care? Linux still has many users to mess with
There are several reasons why Windows is so heavily inflated with anti-virus products. (I am pointing to out-of-the-box (OOTB) experiences).
Windows users are, by default, local administrators, so any social engineering done on Windows can usually lead to an execution of software. Modern Linux has users set-up as low-privilege local users. It requires your password to elevate privilege.
Windows tried to simplify as many things as possible including security and looking back at its history their butchering (Windows Vista anyone?) of security controls left their user-base numb to constant false positives about software. The proverbial "Do you want to install this software? Do you REALLY want to install this software?" lead to just click-throughs or disabling UAC.
Software repositories vs standalone installs:
Linux has had software repositories forever and they provide a good mechanism for installing software. These are usually signed, approved, software being protected by companies with budgets for security following standards for security. (I know about the breaches to repositories in the past, but this is generally good). Windows users are used to pulling sources from everywhere and installing on their system, unsigned or not.
Users generally have different mindsets:
Windows is an all-purpose, all-user platform. It generally tries to solve everyone's problems and in doing so, OOTB doesn't protect the user like it should. This why Microsoft pushes so hard to force every piece of software to be signed by a "trusted signer". There's plenty of debate on this, but generally from a security standpoint this is smart; Microsoft just happens to have a track record that leaves trust to be desired.
Linux users are generally technical and the systems are usually server systems. That's why software usually comes with GPG keys and/or SHA/MD5 hash for comparison, as these are from a Linux administrator perspective, de-facto processes for installing software. I know many Linux users who ignore this, but I have yet to see a Windows administrator even think about it.
So it does go beyond market share.
Expansion:
I will address a few things from the comments (which have valid points.)
Repositories:
From an OOTB experience modern Linux distributions have pre-signed packages which are more for identifying that a package works with the distribution, but also proves a secure method for verification.
Other package management system have been discussed such as pip and npm which are independent of the distributions themselves and are servers to install specific packages for their particular programming language. It can be argued that there is no inherent way for verification on these systems. This is primary because Linux has a philosophy of programs doing one specific thing and doing it well. This is typically why multiple tools are used such as using GPG or PGP for integrity.
Script Downloads
cURL | sh has been mentioned and are truly no different than clicking on a .exe after you have downloaded the file. To point out, cURL is a CLI tool for transferring data. It can do authentication, but it doesn't do verification specifically.
UAC vs sudo
Lastly, here are a few things about these two security features.
UAC is an approval process for untrusted software installation. A user which has local administrator rights simple gets a yes or no (the behavior can be changed, but it's not default). I am still looking to see if this behavior has changed on Windows 8+, but I haven't seen anything on it.
Sudo is a fine-grained permission elevation system. By default it's essentially the same thing as UAC, but it has more ability to be configured to limit accessibility.
The reason for this tends to be historical. There is no reason why a modern desktop Linux should be particularly more resistant to malware when compared to a modern Windows desktop.
However there have been many more viruses for Windows than Linux amongst desktop users, which is down to factors such as the number of users of the respective platforms and also historical weaknesses in the Windows platform such as running as administrator all the time.
So from a market perspective, the reason is that there are more customers for Windows antivirus software than for Linux antivirus software, so as a result more vendors will go into that marketplace.
I've been using Linux for a few years and I actually work with computers etc, but I know NOTHING about cybersecurity, malwares, etc. I've always been told that Linux doesn't have viruses and is much safer than Windows... but why?
Is it just because there's no demand to create malware for such a small portion of computers? I know it's a very basic question, but I only asked myself this question now.
Well, it factually is not... it's just less subject to hackers developing viruses that target Linux systems. Consumer grade computers usually run on Windows and thus, when targeting a wide audience, Windows is the way to go.
Don't misunderstand Linux and viruses, there definitely ARE Linux viruses.
Some distros have additional protection layers such as SELinux (See here) in Ubuntu for example. Then there's the default firewall and the fact that alien files don't automatically have permission to be executed. Specific execution permission has to be granted before execution is possible. (See here)
Then there are several other factors that make Linux a hard place to be for viruses usually non-root users on linux systems have no to little executable files at their disposal that would allow for viruses to stay undetected and propagate. Some programs just require you to be logged in as root (or by use of sudo) before they run or to access/modify directories other than your home. It's just a lot harder to develop a viable virus that would spread as well as it would in Windows.
UPDATE:
As mentioned below, most machines that run Linux are either servers that are run by people who know a thing or two about what they're doing. People that run Linux for desktop use usually choose to and also do know what they're doing. Almost all computer illiterate run Windows and therefore it's much easier to get those computers infected. "Hey, this machine tells me that I have I virus and I have to purchase this Anti-Virus program called 'FAKETrojanHunter' to get rid of it... Okay, let's do it!"
Because no Linux distribution/installation is equal per se, it's harder to develop malware that would infect them all as efficiently as possible. Furthermore, almost all software run on Linux is Open Source, making malware much more easily detectable since its source is open to the public.
Answer from Pylsa on Stack ExchangeIn no modern Operating System viruses are an issue for the sensible user. So viruses are an issue if you're not sensible.
Viruses in fact don't get harmful unless you actually run them. That's almost the same in every different O.S., and do mistrust people telling you "Linux is good because Windows has got viruses" because it's nonsense. Linux (and Ubuntu) is good for many reasons, but this has nothing to do with viruses.
However, running Ubuntu or Linux in general lets you be statistically less prone to get infected by viruses. Ubuntu encourages users to choose official repositories as the main source of software (which are safe), and running an executable by double-click is less easy than in Windows.
But you can still get into a website that asks you to add a poisoning repository, or to install a malicious .deb (with double-click) to add some awesome functionality Ubuntu is missing.
So viruses are a problem because of the user, not because of the system (which in most cases is an innocent victim), even if in some old Windows systems (95, 98, ME but also old versions of XP) one could get a virus without doing anything unsafe, just through some vulnerability of the system. But leaving out pointless chat topics (Micro$oft is baaad, etc...) nowadays Windows systems are safe enough for the use cases they're intended and do get infected because of user inexperience and IT unknowing.
So, to answer your question:
- Windows users are usually less competent users and get infected with ease
- Ubuntu users use repositories which are safe
In no way Ubuntu is stronger towards viruses, I can write one tomorrow, pack it in a .deb, and it would be insidious and destructive also because people think "linux has no viruses". Linux has no viruses until you create one, which can be done in minutes, assuming you can convince the victim that it is safe to execute it.
Speaking of all the security issues in general, but leaving out the viruses, Ubuntu has build-in security.
However, Ubuntu will not stop you from installing malware like the Windows anti-viruses try to do. For example, if someone tricks you into installing software that will spy, spam, or destroy all your data then you're out of luck.
Many more security mechanisms are available if you choose to set them up: firewall rules, anti-virus scanners, network monitoring, two-factor authentication, etc... These additional mechanisms are mostly intended for servers and you should not need to worry about them as a desktop user.
Having that said, there are many vulnerabilities and Linux systems get broken into every day all over the world. Security teams come-out with updates to fix these vulnerabilities regularly. Ubuntu has it's own security team that releases updates and advices for systems administrators.
Here is an overview about anti-Viruses and Ubuntu security.
In practice Ubuntu is much safer than Windows. In terms of exposure to malware, Ubuntu is comparable to Mac. But as @Giacomo pointed out, living in a nearly virus free world can leave Mac users naive.
The top 2 things that you can do to stay extra safe:
- Install software only from the official repository
- Keep your software up by letting the Update Manager do it's thing
my post got deleted on r/linux to uh here i am
so after getting a threat on my windows I thought if my linux could also have any
i looked up for an antivirus and while windows have many many many, linux doesn't seem to have dozens
how come linux doesn't have that many viruses like windows?
I hear people say all the time that viruses are powerless on linux. If this is true, what makes them powerless? why do people say that?
I understand that viruses are a lot less common on linux than they are on windows, but they still do exist. I suspect thats the reason why distros ask you to verify your keys.
For somebody that isn't always legally coherent when it comes to certain things on the sea, I'm incredibly paranoid about doing what I can to protect myself from malware. How does it compare to windows and what do you have to do differently, especially since downloading software is a different process than on windows. Are there common linux specific malware I should be aware of?