Home  >  Article  >  Operation and Maintenance  >  Why does linux have no viruses?

Why does linux have no viruses?

青灯夜游
青灯夜游Original
2022-11-11 17:58:152389browse

Linux is not virus-free, but it has fewer viruses. Reasons for fewer viruses: 1. Linux accounts have restrictions. Even if the virus successfully infects a program owned by this user, its further spread will be very difficult due to the limited user rights; 2. Linux networks have restrictions. Its network programs are built very conservatively, and there are no advanced macro tools that make it possible for viruses to spread quickly; 3. Linux application software and system software are almost all open source, and it is difficult for viruses to hide in open source code.

Why does linux have no viruses?

#The operating environment of this tutorial: linux7.3 system, Dell G3 computer.

Linux is not virus-free, but it has fewer viruses.

So why are there so few viruses in Linux systems? Many people think that Linux has fewer viruses because Linux is not as popular as Windows. In fact, this view has been refuted a long time ago. One of the most powerful arguments is: if a virus writer writes Windows viruses, it is because there are many Windows users. It is highly destructive, so most servers on the Internet are based on Unix/Linux. Wouldn't it be more destructive to attack these servers?

Linux Account Limitation

For a binary Linux virus to infect executable files, these executable files must be writable by the user who started the virus. This is usually not the case. What usually happens is that the program is owned by root and the user runs it from an unprivileged account. Moreover, the more inexperienced a user is, the less likely he is to have an executable file. Therefore, the less familiar a user's home directory is with this danger, the less suitable it is for viruses to propagate.

Even if the virus successfully infects a program owned by this user, the task of spreading it further will be very difficult due to the limited permissions of this user (of course, for Linux newbies running single-user systems , this argument may not apply. Such users may be careless with the root account).

Linux Network Limitations

Linux network programs are built very conservatively and do not have the advanced macro tools that make it possible for Windows viruses to spread so quickly today. This is not an inherent characteristic of Linux; it is simply a reflection of the difference in the two user bases and the resulting different successful products in the two markets.

Linux kernel and user space

Linux’s kernel and user space are clearly separated. Users can even define their own init at startup. The =XXX parameter allows the first process in the user space to be defined by itself. This non-coupling of the kernel space and the kernel space is very important. The kernel allows the user to take over the system by execveing ​​a user process in the init kernel thread. This process is You can define it yourself, but it is usually the /sbin/init process. The result is that even if all user space is injected, you can first delete these dirty files; second, you can set a clean file that you define yourself. init process, all you need to do is to restart the system, and everything is done. The powerful shell command in Linux allows you to easily back up a clean virus-free root file system, so anti-virus under Linux will be a simple task. Very simple thing. The key point here is that the user can independently control the first process in user space. This is difficult under Windows. If you want to replace the SMS program, try it. The system will prompt you "Please make sure the disk is not full or not write-protected and "The file is not used", and the dllcache under system32 is also a directory that you love and hate. If you don't believe it, please manually delete IE and try it.

Open source Linux

Linux application software and system software are almost all open source. This affects the virus in two ways. First of all, it is difficult for viruses to hide in open source code. Secondly, for viruses that only have binary versions, a new compilation and installation cuts off a major transmission route for the virus. Although Linux publishers also provide a large number of binary software packages, users mostly download these software packages from reliable software repositories provided by the publishers. Most of them have md5 verification mechanisms and are extremely secure.

A computer virus, like a biological virus, must reproduce faster than it dies (is eliminated) in order to spread. The barriers mentioned above effectively slow down the reproduction rate of Linux viruses. We have not seen a real Linux virus spread crazily, and the reason is that none of the existing Linux viruses can thrive in the hostile environment provided by Linux

Related recommendations: "Linux Video Tutorial

The above is the detailed content of Why does linux have no viruses?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn