---
name: "capng_set_rootid"
section: "3"
platform: "linux"
package: "libcap-ng"
version: "0.9.6-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux"]
url: "https://new.carta.tech/capng_set_rootid"
---

# capng\_set\_rootid(3)

set namespace root id

## NAME

capng\_set\_rootid - set namespace root id

## SYNOPSIS

**#include \<cap-ng.h\>**

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

## 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

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

[**capng\_apply\_caps\_fd**(3)](/capng_apply_caps_fd/3.md), [**capabilities**(7)](/capabilities/7.md)

## AUTHOR

Steve Grubb
