---
name: "realgroupmember"
section: "9"
platform: "freebsd"
package: "base"
version: "16.0-CURRENT-20261027-61c70dc16a79"
release: "FreeBSD 16.0-CURRENT (2026-10-27)"
platforms: ["freebsd"]
url: "https://new.carta.tech/groupmember"
---

# realgroupmember(9)

checks if credentials mandate some group membership

Part of [groupmember(9)](/groupmember/9.md).

## NAME

**groupmember** – checks if credentials mandate some group membership

## SYNOPSIS

**#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*);

## DESCRIPTION

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.

## SEE ALSO

[getgroups(2)](/getgroups/2.md), [setgroups(2)](/setgroups/2.md)

## AUTHORS

This manual page was initially written by Chad David ⟨*davidc@acns.ab.ca*⟩ and was revised by Olivier Certner ⟨*olce.freebsd@certner.fr*⟩.
