Linux Capabilities Reference

Every Linux capability constant with the privilege it grants, a typical use, and a risk rating

Searchable Linux capabilities reference covering CAP_NET_BIND_SERVICE, CAP_SYS_ADMIN, CAP_SYS_PTRACE, CAP_BPF and the rest, with the exact privilege each grants, a typical use case, and a low/medium/high risk rating.

What are Linux capabilities?

Capabilities split the all-or-nothing power of root into distinct units, so a process can be granted only the specific privileges it needs. For example, a web server can get CAP_NET_BIND_SERVICE to bind port 80 without running as root. They are managed per process and can be attached to executables as file capabilities.

Linux capabilities break the monolithic privilege of root into individual, grantable units. Instead of running a whole program as root to do one privileged thing, you grant just the capability it needs. This reference lists the capability constants with the exact power each confers and a risk rating.

How it works

Each capability is a named bit (e.g. CAP_NET_BIND_SERVICE) that authorizes a specific class of privileged operations. A process carries several capability sets — permitted, effective, inheritable, bounding and ambient — that together decide which privileges are active. Executables can also carry file capabilities, granted on exec, which replace the old setuid-root pattern.

The risk rating here is practical guidance: some capabilities are narrow and safe (CAP_NET_BIND_SERVICE), while others — CAP_SYS_ADMIN, CAP_SYS_MODULE, CAP_BPF, CAP_DAC_OVERRIDE — are powerful enough to be treated as equivalent to full root.

Example

To let a service bind port 443 without root, drop all capabilities and grant only the one it needs:

setcap cap_net_bind_service=+ep /usr/local/bin/myserver
getcap /usr/local/bin/myserver
# /usr/local/bin/myserver cap_net_bind_service=ep

The binary can now bind privileged ports while running as an unprivileged user.

Notes

  • Inspect a running process with cat /proc/PID/status | grep Cap and decode the hex masks with capsh --decode=<hex>.
  • Dropping capabilities in a container (--cap-drop=ALL then --cap-add only what you need) dramatically shrinks the attack surface.
  • CAP_SYS_PTRACE lets a process read any other process’s memory — keep it out of multi-tenant environments.
  • Capabilities pair with seccomp, namespaces and cgroups; alone they are not a full sandbox.