---
name: "pam_getenv"
section: "3"
platform: "linux"
package: "pam"
version: "1.7.3-1"
release: "Arch Linux 2026-11-01"
platforms: ["linux", "freebsd", "macos"]
url: "https://new.carta.tech/pam_getenv/3"
---

# pam\_getenv(3)

get a PAM environment variable

## NAME

pam\_getenv - get a PAM environment variable

## SYNOPSIS

```
#include <security/pam_appl.h>
```

**const char \*pam\_getenv(pam\_handle\_t \****pamh***, const char \****name***);**

## DESCRIPTION

The **pam\_getenv** function searches the PAM environment list as associated with the handle *pamh* for an item that matches the string pointed to by *name* and returns a pointer to the value of the environment variable. The application is not allowed to free the data.

## RETURN VALUES

The **pam\_getenv** function returns NULL on failure.

## SEE ALSO

[**pam\_start**(3)](/pam_start/3.md), [**pam\_getenvlist**(3)](/pam_getenvlist/3.md), [**pam\_putenv**(3)](/pam_putenv/3.md), [**pam**(8)](/pam/8.md)
