Get Linux Securely: Tips for Safe Installation and UpdatesSwitching to Linux is a great way to regain control of your computing, improve privacy, and avoid vendor lock-in. Security, however, requires more than just choosing a distribution — it begins with how you obtain and install the system and continues through careful configuration and regular maintenance. This article walks through practical, hands-on advice to help you “get Linux securely,” from selecting a trustworthy distro to setting up updates and hardening the system.
1. Choose a trustworthy distribution and download sources
- Pick a distribution with an active community, timely security updates, and a clear release model. Good choices for general use include Ubuntu LTS, Debian, Fedora, openSUSE Leap/Tumbleweed, Linux Mint, and privacy-focused options like Tails or Qubes OS for threat-model specific use cases.
- Download ISOs only from official distribution websites or verified mirrors. Avoid third-party hosts unless recommended by the distro project.
- Verify downloads by checking signatures and checksums:
- Many projects publish a SHA256 or SHA512 checksum alongside the ISO. After download, compute the checksum locally and compare.
- For stronger assurance, verify the GPG signature of the release using the distro’s release signing key:
- Import the distro’s public key into your GPG keyring.
- Verify the ISO’s
.sig
or.asc
signature file.
- If you’re unfamiliar with GPG verification, read the distribution’s verification guide — it’s usually straightforward and critical for avoiding tampered images.
2. Prepare installation media safely
- Use reliable hardware: a good-quality USB flash drive from a reputable brand lowers the chance of data corruption.
- Create the bootable media using trusted tools:
- GUI tools: Etcher, Rufus (Windows), or GNOME Disks.
- Command-line: use
dd
carefully (double-check device path) orcp
on some systems.
- After flashing, re-check the USB device’s contents or checksum if your tool supports it to ensure the image burned correctly.
- If using UEFI, disable Secure Boot only if the distribution doesn’t support it. Many modern distros provide signed bootloaders compatible with Secure Boot.
3. Installation best practices
- Backup first: before resizing partitions or replacing an OS, make a full backup of important files. Use external drives or cloud backups you trust.
- Use full-disk encryption if you need confidentiality:
- LUKS is the standard choice on Linux for encrypting partitions.
- During installation, select the “encrypt my disk” or manual LUKS setup.
- Use a strong passphrase (long, unique, and not easily guessable). Consider using a hardware token or a password manager to store recovery keys.
- For dual-boot setups:
- Install Linux after Windows to make GRUB installation smoother, or be prepared to restore bootloaders.
- Consider creating separate encrypted home partitions rather than sharing /home with another Linux install.
- Keep network off during initial setup when possible, or use a firewall to limit exposure until you’ve applied updates.
4. Post-install hardening (first 24–48 hours)
- Update the system immediately:
- Use your package manager (e.g.,
sudo apt update && sudo apt upgrade
,sudo dnf upgrade
,sudo zypper update
) to install security patches.
- Use your package manager (e.g.,
- Create a non-root daily user and use sudo for administrative tasks. Disable direct root SSH login if you enable SSH.
- Enable a firewall:
- Use uncomplicated firewall tools like
ufw
(Ubuntu) orfirewalld
(Fedora/RHEL/openSUSE). - Start with a default deny policy for incoming connections and explicitly allow needed services.
- Use uncomplicated firewall tools like
- Secure SSH:
- If you need remote access, prefer SSH key authentication and disable password authentication in
/etc/ssh/sshd_config
. - Change the default SSH port only as an obfuscation (not a real security measure), and consider tools like
fail2ban
orsshguard
to block brute-force attempts.
- If you need remote access, prefer SSH key authentication and disable password authentication in
- Remove unnecessary services and packages: fewer services mean a smaller attack surface. Audit
systemctl list-unit-files --state=enabled
and disable what you don’t need. - Install and configure an automated update tool if you prefer automatic security updates (e.g.,
unattended-upgrades
on Debian/Ubuntu).
5. Keep the system updated and monitor for security advisories
- Regularly apply updates — many distributions publish security advisories and RSS feeds for critical patches.
- Use distribution tools or third-party services to monitor CVEs relevant to installed packages. For enterprise or advanced personal setups, consider:
- Canonical’s Livepatch (for Ubuntu kernel hotpatching),
- Automatically applied security-only repos (where available),
- Tools like
apt-listchanges
to see what updates include.
- Verify the integrity of critical system files with tools like AIDE or tripwire if you need high assurance of tamper detection.
6. Software sources and package management safety
- Prefer distribution repositories and flatpak/snaps from trusted stores (Flathub, Snap Store) over random third-party repositories.
- If adding third-party repos (PPAs on Ubuntu or vendor repos), ensure they are reputable and remove them when no longer needed.
- Use package signing: distribution package managers verify signatures automatically when repos are configured correctly — don’t disable signature checks.
7. Browser, email, and user-space app security
- Use modern, sandboxed app formats where possible: Flatpak isolates GUI apps better than traditional packages in many setups.
- Harden your browser:
- Keep it up to date.
- Use privacy/security extensions sparingly (adblocker, HTTPS Everywhere-like functionality, script blockers).
- Consider using containerized browser profiles for risky activities (or a dedicated VM).
- Be cautious with email attachments and office macros; treat unknown files as potentially malicious.
8. Privacy-oriented configurations
- Minimize telemetry: some distributions and apps collect optional usage data. Disable telemetry where possible in settings.
- Use system-wide DNS privacy (DNS-over-HTTPS or DNS-over-TLS) via system resolvers or tools like
cloudflared
orstubby
. - For stronger privacy/anonymity needs, consider Tails (VM/live-only) or Qubes OS (compartmentalization).
9. Advanced protections
- Use disk and file-system snapshots (Btrfs or LVM snapshots + backups) to quickly recover from ransomware or misconfiguration.
- Consider application sandboxing: Firejail or bubblewrap can add isolation for GUI and CLI apps.
- Use hardware-backed security:
- TPM for secure boot and disk encryption integration.
- YubiKey or other hardware tokens for SSH key storage and two-factor authentication.
- For high-risk threat models, isolate sensitive activities in VMs or a separate physical machine.
10. Backups and recovery plans
- Regular, automated backups are essential. Follow the 3-2-1 rule: at least three copies, on two different media, with one offsite.
- Test recovery: a backup is only useful if you can restore it. Periodically verify backups.
- Keep recovery tools handy: a live USB with rescue tools, copies of LUKS headers (if using LUKS), and documented recovery steps.
11. Common mistakes to avoid
- Skipping verification of downloaded ISOs — this invites tampered images.
- Using weak encryption passphrases or not encrypting sensitive disks.
- Installing unnecessary third-party software or random PPAs without vetting.
- Neglecting updates — many successful attacks exploit unpatched systems.
- Relying solely on obscurity (changing ports, hiding services) rather than proper hardening.
12. Quick secure-setup checklist
- Verify ISO checksum and GPG signature.
- Write ISO to a reliable USB tool and re-check.
- Backup data before installing.
- Enable full-disk encryption (LUKS) if needed.
- Update immediately after install.
- Create a non-root user and disable root SSH login.
- Enable and configure a firewall.
- Use SSH keys and fail2ban for remote access.
- Subscribe to distro security announcements.
- Implement automated backups and test restores.
If you want, I can provide a step-by-step walkthrough for a specific distribution (Ubuntu, Fedora, Debian, or Qubes) including terminal commands and example configuration files.
Leave a Reply