getseuserbyname(3)

getseuserbyname3

Get selinux username and level for a given linux username

Usage

#include <selinux/selinux.h>

int getseuserbyname(const char *linuxuser, char **selinuxuser, char **level);

Overview

getseuserbyname() retrieves the SELinux username and security level associated with a given Linux username. The SELinux username and security level can then be passed to other libselinux functions such as get_ordered_context_list_with_level(3) and get_default_context_with_level(3).

The returned SELinux username and level should be freed by the caller using free.

Return value

On success, 0 is returned. On failure, -1 is returned and errno is set appropriately.

The errors documented for the stat(2) system call are also applicable here.

Releases

10 releases since Debian 4.0 (Etch); the text changed 3 times.

  1. 4.0
  2. 5.0–7
  3. 8–12
  4. 13

From libselinux1-dev 3.8.1-1 in Debian 13 (Trixie). Parsed by carta from the page's man source.