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

# pam\_putenv(3)

set the value of an environment variable

## NAME

**pam\_putenv** – set the value of an environment variable

## SYNOPSIS

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

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

*int*\

**pam\_putenv**(*pam\_handle\_t \*pamh*, *const char \*namevalue*);

## DESCRIPTION

The **pam\_putenv**() function sets an environment variable. Its semantics are similar to those of [putenv(3)](/putenv/3.md), but it modifies the PAM context's environment list instead of the application's.

## RETURN VALUES

The **pam\_putenv**() function returns one of the following values:

- \[PAM\_SUCCESS\]

  Success.

- \[PAM\_BUF\_ERR\]

  Memory buffer error.

- \[PAM\_SYSTEM\_ERR\]

  System error.

## SEE ALSO

[pam(3)](/pam/3.md), [pam\_getenv(3)](/pam_getenv/3.md), [pam\_getenvlist(3)](/pam_getenvlist/3.md), [pam\_setenv(3)](/pam_setenv/3.md), [pam\_strerror(3)](/pam_strerror/3.md), [putenv(3)](/putenv/3.md)

## STANDARDS

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

## AUTHORS

The **pam\_putenv**() 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.

The OpenPAM library is maintained by Dag-Erling Smørgrav ⟨*des@des.dev*⟩.
