There's always been a lot of debate about how safe Linux is from virus and hacking attacks: inevitably the discussion is distilled to a simplistic comparison between the distribution in question & Windows, but I usually find these comparisons to be unhelpful.
There's a lot of reasons that Windows is more susceptible to attack, not least it dominates the PC market, giving attackers a larger pool of potential victims. Moreover, viruses for 'nix are unheard of in the wild but, before we Linux users get too smug, that doesn't mean that we're impervious to attack! The reality is that all operating systems are vulnerable to some extent and vigilance is always recommended whatever system you choose.
The good news is that there are some very simple steps that new users can take in order to mitigate their exposure to attack. The first, and probably most important, is to choose a strong password. This mitigates the chance that an attacker can guess your password or use a dictionary attack to gain access to your system.
Another important action is to enable the bundled firewall, ufw. The firewall is not enabled by default in Ubuntu or its derivatives but it's easy to enable and, for most users, can be run using default settings1. Open a terminal & then:
sudo ufw enable
Provide your password at the prompt and hit enter. To check your firewall status, at the terminal prompt, type:
sudo ufw status
If all's gone well, you should see the output:
You may also see some additional rules (but only if you've customized your firewall).
Finally, don't forget to install security updates as soon as they become available: these patch your system and close vulnerabilities that attackers might exploit.
Ultimately, security relies on the user, but these simple tips can help keep your system (and your data) secure.
Sources & References:
- Schneier On Security: Choosing Secure Passwords
- Ubuntu Wiki: Uncomplicated Firewall
- Ubuntu Wiki: Basic Ubuntu Security Guide, Desktop Edition
- Ubuntu Forums: Which ports need to be opened in order to "network browse"?
- 1 If you share files across a network, you'll need to add some firewall rules: more about that in another post but I've referenced guidance in the sources section.