whatis least-privilege

Principle of Least Privilege

Also known as: least privilege, PoLP

The security practice of giving every user, service, and program only the permissions it needs to do its job, and nothing more.

What Is the Principle of Least Privilege?

On Linux this means running services under dedicated unprivileged accounts, avoiding root logins, limiting sudo rules, tightening file permissions, and confining processes with systemd sandboxing, SELinux, or AppArmor.

When something is compromised, least privilege limits what the attacker can reach. A web app running as www-data cannot read /etc/shadow; one running as root can.

Example

[Service]
User=app
NoNewPrivileges=true
ProtectSystem=strict