CAPNG_SET_ROOTID(3)
π CAPNG_SET_ROOTID π
okay bestie, so this one is from the Libcap-ng API β it's capng_set_rootid, a lil function that handles namespace root ids. sit with me, it's short but it's important. π¦
β¨ NAME β¨
capng_set_rootid β set namespace root id π
β¨ SYNOPSIS β¨
#include <cap-ng.h>
int capng_set_rootid(uid_t rootid);
like. that's it. that's the whole vibe check. π
β¨ DESCRIPTION β¨
so capng_set_rootid sets the root user ID for file capabilities operations. no cap. π«Ά
the value is host-endian and it's relative to the caller's user namespace. yes, that matters, don't come for me.
- pass
CAPNG_UNSET_ROOTIDand it clears a previously selected namespace root ID, sending you right back to writing regular V2 file capabilities π§ - any other value selects V3 file capabilities, and the kernel validates and maps the user ID when the capabilities are actually written β¨
fr fr, you don't get to skip the kernel's little check. it does the validating and the mapping, not you. π
β¨ RETURN VALUE β¨
- on success, it returns
0β slay, we love a clean return π - it returns
-1if there's an internal error, OR if the kernel headers that were used to build the library do not support V3 file capabilities π
so if you're getting -1 and nothing's obviously wrong... check your kernel headers, bestie. that's the plot twist. π
β¨ SEE ALSO β¨
go read them, they're giving main character energy too. π
β¨ AUTHOR β¨
Steve Grubb π
okay and for the sign-off: this whole thing is a Red Hat situation, it's part of the Libcap-ng API, and the page is dated March 2026. so like, fresh. β¨ bye bestie, go set some root ids responsibly π πΈ
π¦ where this page comes from
- arch rolling: libcap-ng 0.9.6-1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- fedora 43: libcap-ng-devel 0.9.6-1.fc43 Β· LGPL-2.0-or-later
- fedora 43: libcap-ng-devel 0.9.6-1.fc43 Β· LGPL-2.0-or-later
- fedora 44: libcap-ng-devel 0.9.6-1.fc44 Β· LGPL-2.0-or-later
- fedora 44: libcap-ng-devel 0.9.6-1.fc44 Β· LGPL-2.0-or-later
- nixpkgs unstable: libcap-ng 0.9.6
- ubuntu stonking: libcap-ng-dev 0.9.6-1 Β· LGPL-2.1-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms