Practical safety

Practical safety

Security Basics

A practical introduction to Linux security: permissions, least privilege, sudo, user separation, package trust, updates, SSH, firewalls, and safe habits.

Audience
Beginners and everyday administrators
Reading time
18 min

Why Linux is often considered secure

Linux has a strong multi-user permission model, mature networking controls, transparent logs, signed package repositories, frequent security updates, and a culture of least privilege. Those are advantages, not magic shields.

A Linux system can be insecure if it is unpatched, misconfigured, running unnecessary services, using weak SSH credentials, or installing untrusted software.

Permissions as security

Permissions limit what users and services can read, change, or execute. A web server should not own every file on a machine. A normal user should not be able to write system binaries. A private SSH key should not be world-readable.

sudo and least privilege

sudo lets approved users run specific commands with elevated privileges. Least privilege means using elevated rights only for the action that needs them, then returning to normal user privileges.

Avoid running a root shell for routine work. A single mistaken rm, chown, or chmod command as root can damage the whole system.

User separation and service accounts

Linux separates human users, root, and service accounts. Services often run as dedicated users so a compromised service has limited access.

Good service design gives an application ownership of its data directory, read access to configuration it needs, and no broad write access elsewhere.

Package trust and updates

Install software from distribution repositories when possible. They are signed, integrated, and updated through the same mechanism as the rest of the system.

Third-party repositories, random curl | sh installers, and unverified binaries expand your trust boundary. Sometimes they are necessary, but they should be deliberate.

Secure remote access and firewall basics

SSH should use strong passwords or, preferably, key-based authentication. Disable remote root login unless you have a specific and controlled reason. Keep private keys private and protected with passphrases when appropriate.

A firewall reduces exposed network surface. It does not fix vulnerable services, but it can ensure only intended ports are reachable.

Inspect listening ports
ss -tulpen
Read SSH logs
journalctl -u ssh --since today

Common security mistakes

  • Using chmod 777 to fix every permission issue.
  • Piping remote scripts into sudo without reading them.
  • Exposing SSH with weak passwords.
  • Ignoring updates because the system seems to work.
  • Running services as root when they do not need it.
  • Sharing logs that contain tokens, hostnames, usernames, or private paths.

Safe habits for beginners

  • Update regularly through your distribution's package manager.
  • Use sudo only for commands that need it.
  • Keep backups before changing disks, bootloaders, or system configuration.
  • Read package transaction summaries before confirming.
  • Prefer official docs and distribution repositories for security-sensitive changes.