root vs. user
You’ve no doubt heard the rumors that Linux (or Mac OS) doesn’t get viruses. You’ve probably come across the rumor that Linux is more secure because of the way it’s built.
Those rumors are true, for the most part. But, specifically why are they true?
One of the biggest reasons Linux doesn’t get viruses is because of the way user accounts are set up. When you create an account in almost any Linux distro, you’re created a user account, which has limited privilages. It is the root user that can alter the Operating Systems guts.
In a server environment (an office or school), the only person who has access to the root account is the System Administrator. In a Home environment, since you personally installed the Linux OS onto your computer, you get to choose a password for accessing the root account, but the default is still the user account.
So, as a user, you have basic privilages, and you have access to only certain files in the Operating system. The privilages of a user account are almost always sufficient for the average computer user. The root account allows access to all files, including the important files that the OS uses, and you can perform certain functions like partitioning hard disks, installing software, or adjusting firewall settings.
This seperation of privilages makes Linux a tough environment for viruses to reproduce in, given that the default user account’s file access privilages are limited to non-critical files. Attacking the root account is extremely difficult, particularly if you have a good password, and a little bit of encryption; a firewall like SELinux also helps to identify “illegal” tasks, like when an application tries to run in root without telling the user.
“But open-source code is more insecure because all the source is free for the virus makers to exploit!”
If you haven’t heard that argument, I’d be surprised. Well, let’s set the record straight.
The argument that open-source is less secure because it’s open, is self-defeating. In fact, open source is more secure, because it’s open. How can you hide a virus inside an application if all the code is open for anyone to see? Because it’s open source, a virus would be spotted before the app is even close to public release, and when it is released, thousands upon thousands of developers will examine the code before deploying the app for their own purposes.
The root account/user account separation, along with the open-source nature of Linux is what makes it virus free. That’s not saying a virus can’t happen, but Linux is part of an ecosystem that is extremely unfriendly to a virus.
Some might add that another reason Linux is virus free is because of it’s small market share, but I really don’t think that has anything to do with. Linux could have 100% market share, and as long as every part of the OS is open-source, viruses will not get far.

Fedora 11 Beta release notes - FedoraProject

