---
name: "semanage_user"
section: "3"
platform: "linux"
package: "libsemanage-dev"
version: "3.8.1-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/semanage_user"
---

# semanage\_user(3)

SELinux User Management API

## NAME

semanage\_user - SELinux User Management API

## SYNOPSIS

**#include \<semanage/user\_record.h\>**\
 **#include \<semanage/users\_policy.h\>**\
 **#include \<semanage/users\_local.h\>**

This object contains properties associated with a SELinux user. Typically many Unix users are mapped to the same SELinux user. See [**semanage\_seuser**(3)](/semanage_seuser/3.md) for overview of the Unix user API.

For details on a specific function, see its manual page.

## Record API Overview

**semanage\_user\_create**(3)**-**\
 create a user

**semanage\_user\_free**(3)**-**\
 release resources for this user

**semanage\_user\_key\_create**(3)**-**\
 create a key, which can be used to identify a user

**semanage\_user\_key\_free**(3)**-**\
 release resources for this user key

**semanage\_user\_key\_extract**(3)**-**\
 create a key matching this user

**semanage\_user\_clone**(3)**-**\
 create an identical user (deep-copy clone)

**semanage\_user\_compare**(3)**-**\
 compare this user to the provided key

**semanage\_user\_compare2**(3)**-**\
 compare this user to another

## Properties API Overview

**semanage\_user\_get\_name**(3)**-**\
 return the name of this user

**semanage\_user\_set\_name**(3)**-**\
 set the name of this user

**semanage\_user\_get\_prefix**(3)**-**\
 return the labeling prefix for this user, used to control the contexts of user directories

**semanage\_user\_set\_prefix**(3)**-**\
 set the labeling prefix for this user

**semanage\_user\_get\_mlslevel**(3)**-**\
 return the default MLS level, which is assigned to this user at login time

**semanage\_user\_set\_mlslevel**(3)**-**\
 set the default MLS level

**semanage\_user\_get\_mlsrange**(3)**-**\
 return the range of valid MLS sensitivities and categories for this user

**semanage\_user\_set\_mlsrange**(3)**-**\
 set the range of valid MLS sensitivities and categories for this user

**semanage\_user\_add\_role**(3)**-**\
 add a role to the user's list of valid roles

**semanage\_user\_del\_role**(3)**-**\
 remove a role from the user's list of valid roles

**semanage\_user\_has\_role**(3)**-**\
 check if a role is valid for this user

**semanage\_user\_get\_num\_roles**(3)**-**\
 return the number of valid roles for this user

**semanage\_user\_get\_roles**(3)**-**\
 return an array containing the roles for this user

**semanage\_user\_set\_roles**(3)**-** set the roles for this user

## Record Store API Overview

[**semanage\_user\_modify\_local**(3)](/semanage_user_modify_local/3.md)**-**\
 add or update a user in the local store

[**semanage\_user\_del\_local**(3)](/semanage_user_del_local/3.md)**-**\
 delete a user from the local store

[**semanage\_user\_exists**(3)](/semanage_user_exists/3.md)**-**\
 check if a user is defined in the persistent policy

[**semanage\_user\_exists\_local**(3)](/semanage_user_exists_local/3.md)**-**\
 check if a user is defined in the local store

[**semanage\_user\_query**(3)](/semanage_user_query/3.md)**-**\
 query a user in the persistent policy

[**semanage\_user\_query\_local**(3)](/semanage_user_query_local/3.md)**-**\
 query a user in the local store

[**semanage\_user\_count**(3)](/semanage_user_count/3.md)**-**\
 count the number of users defined in the persistent policy

[**semanage\_user\_count\_local**(3)](/semanage_user_count_local/3.md)**-**\
 count the number of users defined in the local store

[**semanage\_user\_iterate**(3)](/semanage_user_iterate/3.md)**-**\
 execute a callback for each user in the persistent policy

[**semanage\_user\_iterate\_local**(3)](/semanage_user_iterate_local/3.md)**-**\
 execute a callback for each user in the local store

[**semanage\_user\_list**(3)](/semanage_user_list/3.md)**-**\
 return an array containing all users in the persistent policy

[**semanage\_user\_list\_local**(3)](/semanage_user_list_local/3.md)**-**\
 return an array containing all users in the local store
