capng_capability_to_name - Linux


The capng_capability_to_name() function converts a capability in capabilities NG format to its textual name. Capabilities are used to grant specific privileges to processes or users.


char *capng_capability_to_name(capng_cap_t cap);


cap: The capability to convert to a name.


#include <cap-ng.h>
#include <stdio.h>

int main(int argc, char *argv[])
    capng_cap_t cap = CAPNG_EFFECTIVE_CAP_SYS_ADMIN;
    char *name = capng_capability_to_name(cap);

    printf("Capability name: %s\n", name);

    return 0;

Common Issues

Incorrect capability: If the provided capability is not a valid capability NG capability, the function will return NULL.


The capng_capability_to_name() function can be used with other capabilities NG functions to manage capabilities. For example, it can be used to display the names of capabilities in a list of capabilities.

Related Commands

capng_name_to_capability: Converts a capability name to its capabilities NG format.
capng_get_caps: Gets the capabilities of a process or user.