Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
function ensure_privileged_or_exit() {
local cap_mask="0x00000007ffffffff"
local cap_bnd=0x$(grep ^CapBnd /proc/self/status | awk '{print $2}')
if [[ $(($cap_mask & $cap_bnd )) != $(($cap_mask)) ]]; then
echo -e "[ERROR] Run with --privileged option."
exit 1
fi
}