Skip to main content.
Index | Support | Documentation | FAQ

Unix Virus

UNIX hasn't yet developed a virus problem because UNIX is a very hostile environment for a virus. Think about how viruses work. Under DOS, there basically are two types. One infects the boot sector of a disk. Every time the system boots, the virus is loaded and attempts to copy itself into the boot sector of any other disk (or diskette) it can find. The other type of virus infects executable files. When a file containing the virus is executed, the virus inserts itself into the code of other executable files. These programs, carried by diskette or to other computers or downloaded from BBS systems, infect programs on other machines. If the people in an office swap diskettes between machines frequently, every PC in the office can become infected quickly.

Now think about what would happen if you loaded an infected program on a UNIX system. It would try to infect other executable programs. But it would only be able to infect files if _you_ have _write_ access to them. Files in your home directory would be vulnerable, but the rest of the system would be safe.

The same would be true with a boot sector virus. Since root should be the only user with write access to the raw disk devices, the virus could not get into the boot sector of the disk. Of course, if permissions are wide open so that anybody can write to anything, or if you make a habit of running unknown and untested programs as root, then the virus could spread throughout your machine.

(If your security is that lax, then you have a lot more to fear from your own users -- or even your own mistakes -- than from any hypothetical virus!) But even if your machine is saturated with the virus, it probably won't spread to other machines, because most system administrators don't give root access to just any program that comes off a diskette or over the network. Also, the virus would have to be tailored for the particular flavor of UNIX involved _and_ the hardware on which it runs. Unlike a DOS virus, which can count on an Intel CPU, a UNIX virus would have to contain executable code that would run on lots of different processors, under any of a multitude of UNIX variants.

So, if _you_ wanted to create a virus, what would you do? Would you spend your time writing a virus that needs to know about all the potential security holes in a half-dozen or more operating system variations, that needs to contain the appropriate machine code for many totally incompatible CPUs, and that probably won't spread to more than a handful of files on any but the most insecure systems? Or would you rather work on a DOS virus that will spread quickly on 99% of the PCs in a typical office? DOS viruses are so common because they're comparatively easy to write. UNIX viruses would be hard to write, and mostly ineffective, so the jerks who write viruses don't waste time on them.

It comes down to this: A virus doesn't do anything that a person couldn't do. Because there are no passwords or file permissions to get in the way, a person who gets access to your PC can change data, delete your files, or reformat your hard drive quickly and easily. So can a virus. If an unauthorized person can't do the same to your UNIX system, then neither can a virus.