---
name: "pam_get_user"
section: "3"
platform: "macos"
package: "OpenPAM"
version: "35"
release: "macOS 26.5"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/pam_get_user"
---

# pam\_get\_user(3)

retrieve user name

## NAME

**pam\_get\_user** – retrieve user name

## LIBRARY

library “libpam”

## SYNOPSIS

**#include \<sys/types.h\>**

**#include \<security/pam\_appl.h\>**

*int*\

**pam\_get\_user**(*pam\_handle\_t \*pamh*, *const char \*\*user*, *const char \*prompt*);

## DESCRIPTION

The **pam\_get\_user** function returns the name of the target user, as specified to [pam\_start(3)](/pam_start/3.md). If no user was specified, nor set using [pam\_set\_item(3)](/pam_set_item/3.md), **pam\_get\_user** will prompt for a user name. Either way, a pointer to the user name is stored in the location pointed to by the *user* argument.

The *prompt* argument specifies a prompt to use if no user name is cached. If it is NULL, the PAM\_USER\_PROMPT will be used. If that item is also NULL, a hardcoded default prompt will be used.

## RETURN VALUES

The **pam\_get\_user** function returns one of the following values:

- \[PAM\_BUF\_ERR\]

  Memory buffer error.

- \[PAM\_CONV\_ERR\]

  Conversation failure.

- \[PAM\_SYSTEM\_ERR\]

  System error.

## SEE ALSO

[pam(3)](/pam/3.md), [pam\_get\_authtok(3)](/pam_get_authtok/3.md), [pam\_get\_item(3)](/pam_get_item/3.md), [pam\_set\_item(3)](/pam_set_item/3.md), [pam\_start(3)](/pam_start/3.md), [pam\_strerror(3)](/pam_strerror/3.md)

## STANDARDS

*X/Open Single Sign-On Service (XSSO) - Pluggable Authentication Modules*, June 1997.

## AUTHORS

The **pam\_get\_user** function and this manual page were developed for the FreeBSD Project by ThinkSec AS and Network Associates Laboratories, the Security Research Division of Network Associates, Inc. under DARPA/SPAWAR contract N66001-01-C-8035 (“CBOSS”), as part of the DARPA CHATS research program.
