Capabilities and seccomp
Quick answer
Linux capabilities divide many traditional root privileges into separate permissions. Seccomp restricts which system calls a thread can make according to a filter or strict mode. These controls solve different problems.
Capabilities govern categories of privileged operations, while a seccomp filter governs system-call access. Passing one control does not imply passing the other or ordinary file permissions. Test expected success and rejection with the intended service identity in isolation.
Prepare the practice environment
Run python3 lab-fixtures/security/setup.py from the extracted root as an ordinary user. Enter the printed fresh private path and check pwd. Use fresh fixtures, Bash with set -e -o pipefail, LC_ALL=C and umask 077. Run each snippet in a separate Bash process, not your interactive shell. Only private files are used; optional examples require an authorized snapshot VM. Do not modify system services or security policy. Review the lab guide.
Prerequisites
Review: SSH and account hardening.
How it works
A process has capability sets including permitted, effective, inheritable, bounding and ambient. The effective set is used for many kernel permission checks. File capabilities can affect capability calculation at exec; they are not the same as process capabilities. CAP_NET_BIND_SERVICE relates to binding privileged Internet ports, subject to namespace and system settings. Avoid broad capabilities such as CAP_SYS_ADMIN when a narrower design works. NoNewPrivs prevents exec from granting privileges not already available; it does not remove existing privileges. Seccomp mode 0 means disabled, 1 strict, 2 filter; mode 2 alone does not tell you which calls are allowed. Inspect the current shell or a synthetic record, not another user’s process. Do not change capabilities or filters in this lab.
Try the examples
The synthetic process has a nonzero effective mask and an active filter; the policy details are unknown.
Expected stdout:
CapEff: 0000000000000400NoNewPrivs: 1Seccomp: 2This decodes a fixed bitmask; it does not grant capabilities.
Expected stdout:
0x0000000000000400=cap_net_bind_servicecaps=$(getcap ./payload.txt) && test -z "$caps" && printf 'no file capabilities reported\n'No capability entry is reported for the ordinary fixture. This is not a process capability check.
Expected stdout:
no file capabilities reportedCommon mistakes
Never infer a complete sandbox from one status field or grant broad privileges merely to make a service start.
Practice
Compare the synthetic mask, NoNewPrivs and Seccomp fields. Explain which describes a privilege and which describes syscall restrictions.
Related references
Study: getcap, capsh. These are reference names, not deployed links.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Capabilities and seccomp — Knowledge Check
Apply defensive security concepts to synthetic fixtures and VM-only scenarios.
What does CapEff describe?
What does seccomp mode 2 mean?
Does NoNewPrivs remove existing capabilities?
Does capsh --decode grant privileges?