Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions docs/pages/server-access/guides/ssh-pam.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,26 @@ session required pam_permit.so

Next, create a script that will be run by `pam_exec.so`.

Create a directory where you will store the script:

```code
mkdir -p /etc/pam-exec.d
cat > /etc/pam-exec.d/teleport_acct <<"EOF"
$ mkdir -p /etc/pam-exec.d
```

In `/etc/pam-exec.d`, add a file called `teleport_acct` with the following
content:

```text
#!/bin/sh
COMMENT="User ${TELEPORT_LOGIN} for ${TELEPORT_USERNAME} with roles ${TELEPORT_ROLES} created by Teleport."
/bin/id -u "${TELEPORT_LOGIN}" > /dev/null 2>&1 || /sbin/useradd -m -s /bin/bash -c "${COMMENT}" "${TELEPORT_LOGIN}" 2>> /tmp/pam.error
exit 0
EOF
chmod +x /etc/pam-exec.d/teleport_acct
```

Ensure that your script is executable:

```code
$ chmod +x /etc/pam-exec.d/teleport_acct
```

This script will check if the login assigned to `TELEPORT_LOGIN` exists and, if
Expand Down