---
name: "pam_open_session"
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_open_session"
---

# pam\_open\_session(3)

open a user session

## NAME

**pam\_open\_session** – open a user session

## SYNOPSIS

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

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

*int*\

**pam\_open\_session**(*pam\_handle\_t \*pamh*, *int flags*);

## DESCRIPTION

The **pam\_open\_session**() sets up a user session for a previously authenticated user. The session should later be torn down by a call to [pam\_close\_session(3)](/pam_close_session/3.md).

The *flags* argument is the binary or of zero or more of the following values:

- PAM\_SILENT

  Do not emit any messages.

If any other bits are set, **pam\_open\_session**() will return PAM\_BAD\_CONSTANT.

## RETURN VALUES

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

- \[PAM\_SUCCESS\]

  Success.

- \[PAM\_ABORT\]

  General failure.

- \[PAM\_BAD\_CONSTANT\]

  Bad constant.

- \[PAM\_BUF\_ERR\]

  Memory buffer error.

- \[PAM\_CONV\_ERR\]

  Conversation failure.

- \[PAM\_PERM\_DENIED\]

  Permission denied.

- \[PAM\_SERVICE\_ERR\]

  Error in service module.

- \[PAM\_SESSION\_ERR\]

  Session failure.

- \[PAM\_SYSTEM\_ERR\]

  System error.

## SEE ALSO

[pam(3)](/pam/3.md), [pam\_close\_session(3)](/pam_close_session/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\_open\_session**() 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*⟩.
