---
title: "Least privilege"
url: https://www.daytona.com/definitions/l/least-privilege
---

# Least privilege

Least privilege is the security principle of giving every user, program and machine only the access it needs to do its job, and nothing more.

The principle of least privilege says that each part of a system should have only the permissions its task requires. A program that only reads files should not be able to write them. A service that talks to one database should not hold keys to others. Access is granted for a purpose and removed when the purpose ends.

Least privilege limits the damage of a mistake or an attack. When an account or program is compromised, the attacker gets only what it could reach. Broad access turns a small break-in into a large one. The cost is the work of defining and maintaining narrow permissions, which is why systems often drift toward granting too much.

Sandboxes apply least privilege to the code they run. A sandbox gets only the files, network access, secrets and capabilities its task needs. Inside it, processes can run as a normal user rather than as root. A short-lived credential scoped to one task does less harm if code in the sandbox leaks it.
