2 min read

How to Secure Your Linux System (Practical Guide)

How to Secure Your Linux System (Practical Guide)

Linux is already more secure than many operating systems β€” but secure by default does not mean secure forever.
A few smart steps can dramatically reduce your risk without making your system harder to use.

This guide focuses on practical, real-world Linux security, not theory or fear-mongering.


πŸ” 1. Keep Your System Updated (Most Important Step)

Security fixes are delivered through updates.
An unpatched system is the #1 reason Linux machines get compromised.

Update regularly:

Arch / Manjaro

sudo pacman -Syu

Ubuntu / Debian

sudo apt update && sudo apt upgrade

Fedora

sudo dnf upgrade

πŸ‘‰ If you do only ONE thing: update your system.


πŸ‘€ 2. Use a Normal User (Not Root)

Never use Linux as root for daily work.

Why?

  • Root can change anything
  • One mistake can destroy your system
  • Malware running as root is catastrophic

Correct setup:

  • Root account β†’ admin only
  • Daily work β†’ normal user with sudo

Check:

whoami

πŸ”‘ 3. Use Strong Passwords (Yes, It Matters)

Even on Linux.

Good password rules:

  • At least 12 characters
  • Mix letters, numbers, symbols
  • Avoid dictionary words

Change your password:

passwd

Optional (recommended):

  • Use a password manager
  • Enable disk encryption during install

πŸ”₯ 4. Enable a Firewall (Simple & Powerful)

Most desktops don’t enable a firewall by default β€” but they should.

Use UFW (Beginner-Friendly)

Install:

sudo pacman -S ufw        # Arch
sudo apt install ufw      # Ubuntu

Enable:

sudo ufw enable

Check status:

sudo ufw status

That’s it.
You now block unwanted inbound connections.


πŸšͺ 5. Lock Down SSH (If You Use It)

If SSH is installed, attackers will try it.

Basic SSH hardening:

Edit config:

sudo nano /etc/ssh/sshd_config

Set:

PermitRootLogin no
PasswordAuthentication no

Restart SSH:

sudo systemctl restart sshd

πŸ‘‰ Use SSH keys, not passwords.


🚨 6. Install Fail2Ban (Stops Brute-Force Attacks)

Fail2Ban automatically blocks IPs that repeatedly fail login attempts.

Install:

sudo pacman -S fail2ban
sudo apt install fail2ban

Enable:

sudo systemctl enable --now fail2ban

This alone stops most automated attacks.


πŸ“¦ 7. Install Software Only from Trusted Sources

Avoid random scripts and unknown installers.

Safe sources:

  • Official repositories
  • Verified AUR packages (read comments!)
  • Flatpak / Snap from trusted publishers

🚫 Avoid:

curl something | sudo bash

Unless you fully trust the source.


🧠 8. Understand File Permissions (Basic Level)

Linux security relies heavily on permissions.

Quick check:

ls -l

Key rule:

  • Files you don’t trust should not be executable
  • Scripts should not be world-writable

Remove execute permission:

chmod -x file.sh

🧩 9. Enable Automatic Security Updates (Optional)

For laptops and desktops, this is a good idea.

Ubuntu

sudo apt install unattended-upgrades

Arch

  • Use a cron job or systemd timer

This ensures security patches are applied even if you forget.


🧼 10. Remove What You Don’t Use

Less software = smaller attack surface.

Check installed packages:

pacman -Q
apt list --installed

Remove unused services:

sudo systemctl disable service_name

πŸ§ͺ 11. Antivirus on Linux? (Do You Need It?)

For most desktop users:
πŸ‘‰ No

But consider antivirus if:

  • You share files with Windows users
  • You run a mail or file server
  • You work in enterprise environments

Popular tool:

  • ClamAV (mostly for scanning files)

πŸ›‘οΈ 12. Advanced Security (Optional)

For advanced users:

  • AppArmor or SELinux
  • Full disk encryption
  • Secure boot
  • Audit logs

These are powerful β€” but not required for most users.


βœ… Linux Security Checklist

βœ” System updated
βœ” Normal user account
βœ” Firewall enabled
βœ” SSH secured
βœ” Fail2Ban running
βœ” Trusted software sources
βœ” Strong passwords

If you follow just half of these, your Linux system is already very secure.


🧠 Final Thought

Linux security isn’t about paranoia β€” it’s about good habits.

A few minutes of setup can protect your system for years.