Linux capabilities
A smaller set of special permissions
Most computers have a special account called root. It can perform many system-wide actions, such as changing network settings or managing files owned by other accounts. A program running as root can use that broad authority. Linux capabilities divide some of those powerful actions into smaller permissions, so a program can receive one specific power without receiving every power of root. The kernel, Linux’s core part that enforces system rules, checks a capability when the program tries the action it allows. File ownership and ordinary read and write permissions still apply.
A port is a numbered endpoint that receives network traffic. A web service listening directly on port 443 may need permission to use ports below 1024. CAP_NET_BIND_SERVICE grants that particular ability. The service can bind to the port without running as root. It still receives an extra privilege, so assign it only when the service needs it.
How Linux tracks capabilities
Linux tracks capability sets for each thread, the part of a program that runs instructions. The effective set contains powers in use for permission checks. The permitted set limits which capabilities the thread can make effective. Inheritable and ambient sets can affect which powers carry into another program when one process starts it, subject to execution rules. The bounding set limits capabilities that can be gained during program execution. An executable file can also store file capabilities; when it runs, the kernel combines them with the caller's credentials and capability sets.
These commands show capabilities attached to a file or held by a running process:
getcap /usr/bin/ping
getpcaps 1234
capsh --print
Replace 1234 with the process ID. getcap lists file capabilities, getpcaps reports a process's sets, and capsh --print shows the current shell's state. The tools may not be installed, and permissions can limit access to another process's details. A capability on an executable does not prove every person who runs it receives that power; the kernel's rules and the caller's current sets determine the result.
On a disposable test program, setcap can attach permitted and effective capability bits to the executable:
sudo setcap cap_net_bind_service=+ep ./server
getcap ./server
This is stored as file metadata. Any user who runs the file may receive the capability if execution rules allow it, so the grant is not restricted to one service account. Replacing the binary can remove or change its file capability. A service manager or container runtime can also grant selected capabilities to a workload; review the program and environment when using those settings.
Some capabilities are broad. CAP_SYS_ADMIN covers many system operations. Namespaces, seccomp, security modules, and file permissions can still restrict a process with a capability. When investigating a privilege error, identify the requested operation, inspect the process's sets and file metadata, then recheck after updating a binary or rebuilding an image.




