Free Agent: Linux Firewalls and Antivirus--Needed or Not?

Windows XP, left unpatched, is vulnerable to malware that can make it shrivel up and die within a few minutes of being connected to the Internet. Even after patching, Windows is still subject to virus and spyware attacks that make third-party security tools a must. Linux, on the other hand, has a reputation for being relatively impervious to attack via the Net. But is it really immune to the threats that stalk Windows?

The answer has long been, and still is, a qualified yes. Sure, occasionally viruses, worms, and rootkits are written specifically to compromise Linux systems. But if you avoid a couple of major blunders, those relatively few threats are unlikely to do you any real harm, for reasons I'll go into below. To sleep utterly soundly, however, you may still need to take some steps to malware-proof your Linux system.

The Tables Have Turned

The first reason your Linux system is probably safe from attack: Recent versions of Linux (kernels 2.4 and 2.6) include a built-in firewall called "iptables" that simply drops all uninvited incoming connections by default. If a worm or a person tries to break into your Linux box from afar, or not so afar, iptables simply turns away and ignores the incoming connection--the attacker won't know whether a system even exists at the attacked address.

If you don't run mail, Web, FTP, or other servers on your Linux system, you'll probably never need to modify iptables' default settings. However, if you use the Samba server suite to enable file and printer sharing with other local systems, you will have to enable incoming connections to the Samba server in iptables.

If you use Samba, set your iptables firewall to allow incoming connections to the Samba server.
If you use Samba, set your iptables firewall to allow incoming connections to the Samba server.
In SuSE 10.1 (the distribution I'm most comfortable with), the Yast2 configuration tool lets you make this change in a few clicks: Select Firewall in the 'Security and Users' section, click Allowed Services in the left panel, pick Samba Server from the 'Service to Allow' menu, and then click Add, Next, Accept to make the change. If your distribution lacks a similar interface, try Luigi Genoni's graphical iptables configuration interface, Knetfilter. And, of course, you can configure iptables from the command line; Troy Johnson's Samba and IPTables page shows you how.

Antivirus--Not Just for Windows

Here's another reason Linux tends to deflect spyware: By default, most Linux distributions wisely set you up as a lower-privilege user, with a type of account that generally can't allow malicious code to take over the system. Were you to somehow permit a Linux virus or worm to run on your computer, the fact that you are not logged in on the all-powerful root account prevents the malware from attacking the system's (and other users') files. That's why you typically have to log in as root (with the root password) to change Linux system configurations. In contrast, the default Windows XP user account is the full-privilege administrator, which gives viruses and other threats greater leeway to infect and damage the PC.

So simply by not disabling the existing firewall, and by not logging in as root for your day-to-day Web browsing and e-mail, you'll avoid the vast majority of threats. Keep yourself even safer by updating your software regularly to close the inevitable security holes that expose your machine to worms, rootkits, and other exploits.

However, should someone you know lose their head and log in as root, and then run a program that happens to be infected with one of the few Linux viruses known to exist in the wild, that virus could definitely destroy or steal user data. And even if you think you're smart enough to avoid infection, the files moving through your mailbox, Samba file shares (shared files mounted as drives), and other storage mechanisms could still contain viruses destined to infect other systems. These are valid reasons why you might want to use antivirus software on your Linux computer.

Although commercial Linux antivirus products exist, save your money and start with one of several excellent free utilities instead. Even better, pick one that is not only free but open source: the delightfully named Clam AntiVirus. In addition to binary packages (no compiling necessary) for most major Linux distributions, ClamAV is also available for Windows and Mac OS X.

If you'd prefer antivirus software with a commercial track record, try the Linux version of Grisoft's renowned AVG Anti-Virus Free Edition. Because of Linux's inherent safety, the system you save may not be your own, but you'll be doing your part to curb malware altogether.

PC World Contributing Editor Scott Spanbauer is sitting in for Free Agent author Matthew Newton this month.

Subscribe to the Best of TechHive Newsletter

Comments