Making your Linux installation (more) malware-proof

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.

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.

Join the PC World newsletter!

Error: Please check your email address.

Our Back to Business guide highlights the best products for you to boost your productivity at home, on the road, at the office, or in the classroom.

Keep up with the latest tech news, reviews and previews by subscribing to the Good Gear Guide newsletter.

Scott Spanbauer

Computerworld
Show Comments

Essentials

Microsoft L5V-00027 Sculpt Ergonomic Keyboard Desktop

Learn more >

Lexar® JumpDrive® S57 USB 3.0 flash drive

Learn more >

Mobile

Lexar® JumpDrive® S45 USB 3.0 flash drive 

Learn more >

Exec

HD Pan/Tilt Wi-Fi Camera with Night Vision NC450

Learn more >

Audio-Technica ATH-ANC70 Noise Cancelling Headphones

Learn more >

Lexar® JumpDrive® C20c USB Type-C flash drive 

Learn more >

Lexar® Professional 1800x microSDHC™/microSDXC™ UHS-II cards 

Learn more >

Budget

Back To Business Guide

Click for more ›

Most Popular Reviews

Latest News Articles

Resources

PCW Evaluation Team

Michael Hargreaves

Windows 10 for Business / Dell XPS

I’d happily recommend this touchscreen laptop and Windows 10 as a great way to get serious work done at a desk or on the road.

Aysha Strobbe

Windows 10 / HP Spectre

Ultimately, I think the Windows 10 environment is excellent for me as it caters for so many different uses. The inclusion of the Xbox app is also great for when you need some downtime too!

Mark Escubio

Windows 10 / Lenovo Yoga

For me, the Xbox Play Anywhere is a great new feature as it allows you to play your current Xbox games with higher resolutions and better graphics without forking out extra cash for another copy. Although available titles are still scarce, but I’m sure it will grow in time.

Kathy Cassidy

STYLISTIC Q702

First impression on unpacking the Q702 test unit was the solid feel and clean, minimalist styling.

Anthony Grifoni

STYLISTIC Q572

For work use, Microsoft Word and Excel programs pre-installed on the device are adequate for preparing short documents.

Featured Content

Latest Jobs

Don’t have an account? Sign up here

Don't have an account? Sign up now

Forgot password?