realgroupmember(9)

realgroupmember9

Checks if credentials mandate some group membership

Part of groupmember(9).

Usage

#include <sys/param.h>

#include <sys/ucred.h>

bool

groupmember(gid_t gid, const struct ucred *cred);

bool

realgroupmember(gid_t gid, const struct ucred *cred);

Overview

The groupmember() function checks if credentials cred indicate that the associated subject or object is a member of the group designated by the group ID gid.

Considered groups in cred are the effective and supplementary groups. The real group is not taken into account.

Function realgroupmember() works the same except that it considers instead the real and supplementary groups, and not the effective one.

Return values

The groupmember() and realgroupmember() functions return true if the given credentials indicate membership of the group gid, or false otherwise.

Releases

12 releases since FreeBSD 13.3-RELEASE; the text changed 3 times.

  1. 13.3–13.4
  2. 13.5
  3. 14.0–14.2
  4. 14.3–16.0

Authors

This manual page was initially written by Chad David ⟨[email protected]⟩ and was revised by Olivier Certner ⟨[email protected]⟩.

From base 16.0-CURRENT-20261027-61c70dc16a79 in FreeBSD 16.0-CURRENT (2026-10-27). Parsed by carta from the page's mdoc source.