---
name: "pam_close_session"
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_close_session"
---

# pam\_close\_session(3)

terminate PAM session management

## NAME

pam\_close\_session - terminate PAM session management

## SYNOPSIS

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

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

## DESCRIPTION

The **pam\_close\_session** function is used to indicate that an authenticated session has ended. The session should have been created with a call to [**pam\_open\_session**(3)](/pam_open_session/3.md).

It should be noted that the effective uid, [**geteuid**(2)](/geteuid/2.md). of the application should be of sufficient privilege to perform such tasks as unmounting the user's home directory for example.

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

PAM\_SILENT

Do not emit any messages.

## RETURN VALUES

PAM\_ABORT

General failure.

PAM\_BUF\_ERR

Memory buffer error.

PAM\_SESSION\_ERR

Session failure.

PAM\_SUCCESS

Session was successfully terminated.

## SEE ALSO

[**pam\_open\_session**(3)](/pam_open_session/3.md), [**pam\_strerror**(3)](/pam_strerror/3.md)
