Overview
Linux decouples traditional superuser omnipotence into discrete privileges known as POSIX capabilities. This tutorial explores hands-on auditing of these fine-grained attributes using the getpcaps diagnostic utility, detailing how to evaluate running processes and correctly decipher kernel privilege notations.
1. Setting Up the libcap Toolkit on Ubuntu
To obtain the capability management suite, install the official libcap2-bin runtime package via APT:

Verify proper installation and locate the binary path within your search environment using which getpcaps:

2. Inspecting Standard User Processes and Interpreting Flags
Launch a non-privileged background workload with sleep 100 & to serve as an evaluation target:

Capture the process identifier of the newly dispatched background job into a shell variable:

Query the privilege sets assigned to the target PID by issuing getpcaps $TARGET_PID.
When the output yields =ep, it indicates that the process inherited an unrestricted scope across both the Effective and Permitted privilege sets under the current execution context:

Terminate the dummy test workload once analysis concludes:

3. Auditing Elevated System Daemon Privileges
Extract the process ID of an active core system daemon—such as network resolution services or init—into an environment variable:

Inspect the elevated capability profile of the targeted system service using getpcaps $SYSTEMD_PID.
An expression like cap_net_raw=eip demonstrates that raw socket generation (cap_net_raw) is actively enabled across the Effective, Inheritable, and Permitted credential sets:

4. Capability Assignment Workflow and Runtime Verification
To safely experiment with permission assignment without touching system binaries, duplicate the standard ping utility locally:

Grant the cloned executable raw networking authorization using file-based capabilities via sudo setcap cap_net_raw+ep ./my_ping:

Spawn the newly configured executable in the background to monitor its runtime security context:

Retain the operational PID of this newly initiated task:

Audit the operational capabilities of the active task with getpcaps $PING_PID.
A lone = output signifies an empty capability set; unprivileged invocation contexts often strip or fail to inherit targeted file capabilities during runtime transitions unless explicit inheritance flags are preserved:

Halt the ongoing background network ping process:

Remove the temporary executable to keep your working environment clean:

Leveraging getpcaps offers crucial visibility into how privileges are scoped and distributed across modern Linux distributions. Applying least-privilege principles by confining processes to strictly necessary capabilities remains a pillar of robust server hardening.