CAPNG\_SET\_ROOTID(3) Libcap-ng API CAPNG\_SET\_ROOTID(3)

# [NAME](#NAME)

capng\_set\_rootid - set namespace root id

# [SYNOPSIS](#SYNOPSIS)

**#include &lt;cap-ng.h&gt;**

int capng\_set\_rootid(uid\_t rootid);

# [DESCRIPTION](#DESCRIPTION)

capng\_set\_rootid sets the root user ID for file capabilities operations. The value is host-endian and relative to the caller's user namespace. Pass CAPNG\_UNSET\_ROOTID to clear a previously selected namespace root ID and go back to writing regular V2 file capabilities. Other values select V3 file capabilities; the kernel validates and maps the user ID when the capabilities are written.

# [RETURN VALUE](#RETURN_VALUE)

On success, it returns 0. It returns -1 if there is an internal error or the kernel headers used to build the library do not support V3 file capabilities.

# [SEE ALSO](#SEE_ALSO)

[**capng\_apply\_caps\_fd**(3)](/man/os/libcap-ng/capng_apply_caps_fd.3), [**capabilities**(7)](/man/os/libcap-ng/capabilities.7)

# [AUTHOR](#AUTHOR)

Steve Grubb

March 2026 Red Hat

---

Document: capng_set_rootid(3) from libcap-ng 0.9.6-r0 (Chainguard OS)
Source: https://github.com/stevegrubb/libcap-ng.git
