CAPNG_STAGE_ADDITIONAL_GROUPS(3)
π CAPNG_STAGE_ADDITIONAL_GROUPS π
okay bestie, welcome to the Libcap-ng API, section 3, page CAPNG_STAGE_ADDITIONAL_GROUPS. this one is lowkey niche but it's giving backstage-pass energy, so let's get into it π
β¨ NAME β¨
capng_stage_additional_groups β stage additional gids for capng_change_id
πΈ SYNOPSIS πΈ
#include <cap-ng.h>
int capng_stage_additional_groups(const gid_t *gids, size_t count);
π¦ DESCRIPTION π¦
so here's the vibe: this function stages an additional gid list, ready and waiting for the next capng_change_id(3) call β but only if that call uses CAPNG_APPLY_STAGED_GROUPS. like, you're setting out the outfit the night before, but you only actually wear it if you pick that flag in the morning π
the gids get copied into libcap-ng internal state. and then? once capng_change_id returns, libcap-ng clears the staged gids. every time. no leftovers, no clingy exes. that clearing happens whether they were:
- applied β
- ignored because the flag was not set π
- or discarded because the call failed π
and if staged gids somehow remain unused, libcap-ng also clears them when the thread-local state is deinitialized. so nothing's lingering, periodt β¨
passing a count of 0 clears any currently staged gids. that's your reset button, bestie π«Ά
ngl, normally you should stick to using the supplemantal groups that are associated with the uid's account that is being changed to. this whole thing exists so you can simulate the gid model that systemd uses. no cap.
this interface is available in libcap-ng 0.9.3 and later β
π₯ RETURN VALUE π₯
- returns
0on success π - returns
-1on failure π
a non-zero count with a NULL gids pointer fails with errno set to EINVAL. yeah, she said what she said π
π SEE ALSO π
π AUTHOR π
Steve Grubb
that's the whole page, bestie, you ate it up π thanks for reading β this one's from Red Hat, Mar 2026, and it lives in the Libcap-ng API section as CAPNG_STAGE_ADDITIONAL_GROUPS(3). go stage those groups, main character πβ¨π§
π¦ where this page comes from
- arch rolling: libcap-ng 0.9.6-1 Β· GPL-2.0-or-later AND LGPL-2.1-or-later
- centos-stream 10: libcap-ng-devel 0.9.3-2.el10 Β· LGPL-2.0-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
- nixos 26.05: libcap-ng 0.9.3
- 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