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

# cuserid(3)

get user name associated with effective UID

## NAME

**cuserid** – get user name associated with effective UID

## LIBRARY

library “libcompat”

## SYNOPSIS

**#include \<stdio.h\>**

*char* *\**\

**cuserid**(*char \*s*);

## DESCRIPTION

The **cuserid**() function is made obsolete by [getpwuid(3)](/getpwuid/3.md).

The function **cuserid**() gets the user name associated with the effective UID of the current process. If the argument *s* is non-NULL, the name is copied to the buffer it points to, and that address is being returned. This buffer must provide space for at least *L\_cuserid* characters. The L\_cuserid constant is defined in ⟨stdio.h⟩.

If *s* is NULL, an internal array is used and its address will be returned.

## RETURN VALUES

The **cuserid**() function returns the address of an array in which the name has been stored.

If the name associated with the effective UID of the current process could not be found, either a null pointer will be returned, or (if *s* is non-NULL) the buffer *s* will be filled with a null string.

## SEE ALSO

[geteuid(2)](/geteuid/2.md), [getpwuid(3)](/getpwuid/3.md)
