PAM_SSH(8)
πΈ NAME πΈ
pam_ssh β authentication and session management with SSH private keys. This is the PAM_SSH(8) page, bestie π
β manual name folded in right here, no boring header line needed.
β¨ SYNOPSIS β¨
[service-name] module-type control-flag pam_ssh [options]
π DESCRIPTION π
Okay so pam_ssh is the SSH authentication service module for PAM, and itβs lowkey doing two whole jobs. It provides functionality for two PAM categories: authentication and session management. In terms of the module-type parameter, those are the auth and session features. It also provides null functions for the remaining categories. Versatile icon behavior π
π SSH Authentication Module π
The SSH authentication component verifies the identity of a user by prompting the user for a passphrase and verifying that it can decrypt at least one of the userβs SSH login (or authentication) keys using that passphrase. Basically: passphrase goes in, key gets vibe-checked, slay β¨
The userβs SSH login keys must be either located or symbolically linked into the per-user dedicated folder ~/.ssh/login-keys.d/ in the userβs home directory.
The following options may be passed to the authentication module:
debugβsyslog(3)debugging information atLOG_DEBUGlevel.use_first_passβ If the authentication module is not the first in the stack, and a previous module obtained the userβs password, that password is used to decrypt the userβs SSH login keys. If this fails, then the authentication module returns failure without prompting the user for a passphrase.try_first_passβ Similar to theuse_first_passoption, except that if the previously obtained password fails to decrypt any of the SSH login keys, then the user is prompted for an SSH passphrase.nullokβ Allow SSH keys with no passphrase.
If neither use_first_pass nor try_first_pass is specified, pam_ssh will unconditionally ask for an SSH passphrase.
The now deprecated name allow_blank_passphrase for nullok is kept for compatibility reasons.
π¦ SSH Session Management Module π¦
The SSH session management component initiates sessions by launching an SSH agent, passing it any userβs SSH login keys successfully decrypted during the authentication phase and any additional user SSH session keys successfully decrypted, and sets dedicated environment variables accordingly; the environment variable TMPDIR, which can be set through the pam_tmpdir module for instance, is also honoured by being passed to the SSH agent. Teamwork, honestly π«Ά
The SSH session management component terminates the session by killing the previously launched SSH agent by sending it a SIGTERM.
The traditional SSH keys ~/.ssh/id_rsa, ~/.ssh/id_dsa, ~/.ssh/id_ecdsa, and ~/.ssh/id_ed25519 are considered as the default SSH session keys. Nonetheless, extra user SSH session keys can be either located or symbolically linked into the per-user dedicated folder ~/.ssh/session-keys.d/ in the userβs home directory.
Provided that they have been successfully decrypted, the SSH session management passes to the launched SSH agent:
- first the session SSH keys in lexical order,
- second the login SSH keys in lexical order,
- finally the traditional SSH keys in the reverse order cited above.
Since the SSH agent keeps in its memory for each passed key its first position (but its last comment), each SSH key rank can be easily overwritten with an appropriate symbolic link placed in ~/.ssh/session-keys.d/ or ~/.ssh/login-keys.d/; this is especially true for the traditional SSH keys. The involved lexical order is performed against the SSH key file basenames (according to the C/POSIX locale character collation rules). Because actually their basenames are passed as comments, their effective order might be easily checked with an appropriate SSH agent helper as ssh-add(3). As final remark, keep in mind that the SSH agent may place itself SSH keys with protocol 1 before SSH keys with protocol 2.
The following option may be passed to the session management module:
debugβsyslog(3)debugging information atLOG_DEBUGlevel.
π¨ INFORMATION LEAKS π¨
Be careful with using thetry_first_passoption whenpam_sshis the first authentication module, because it will then leak information about existing users without login keys: such users will not be asked for a specific SSH passphrase, whereas non-existing users and existing users with login keys will be asked for a passphrase. Not the cute kind of plot twist, bestie.
π FILES π
~/.ssh/β This directory is the default per-user location for all user-specific SSH configuration and SSH authentication information as expected by SSH and its friends.~/.ssh/id_rsa,~/.ssh/id_dsa,~/.ssh/id_ecdsa,~/.ssh/id_ed25519β Contains the traditional private key for authentication. These files contain sensitive data and should be readable by the user but not accessible by others: any traditional private key file that is accessible by others is simply ignored. While the SSH authentication component ignores the traditional private keys, the SSH session management component passes any successfully decrypted traditional key to the launched SSH agent.~/.ssh/login-keys.d/β This directory is the dedicated per-user location for files or symbolic links to files that contain SSH private keys considered by the SSH authentication component.pam_sshignores any private key file that is accessible by others or that possesses.disabledor.frozenas suffix. Each login key successfully decrypted is passed by the SSH session management component to the launched SSH agent.~/.ssh/session-keys.d/β This directory is the dedicated per-user location for files or symbolic links to files that contain (extra) SSH private keys considered only by the SSH session management component.pam_sshignores any private key file that is accessible by others or that possesses.disabledor.frozenas suffix. Each session key successfully decrypted is passed to the launched SSH agent./run/pam_ssh/<user>*βssh-agentenvironment information. The files are owned by the superuser but readable by the users. The location is Fedora specific, in the original package these files are in$HOME/.ssh/agent-*.
π SEE ALSO π
π AUTHORS π
- Andrew J. Korty
<ajk@iu.edu>wrotepam_ssh. - Dag-Erling Smorgrav wrote the original OpenPAM support code.
- Mark R V Murray wrote the original version of this manual page.
- Jens Peter Secher introduced the login-key concept.
- Refreshed for Debian by Jerome Benoit
<calculus@rezozer.net>. pam_sshis currently maintained by Wolfgang Rosenauer.
mwah π β thatβs the January 14, 2019 edition of PAM_SSH(8), bestie π«Ά
π¦ where this page comes from
- epel 9: pam_ssh 2.3-8.el9 Β· BSD
- fedora 43: pam_ssh 2.3-21.fc43 Β· BSD-2-Clause
- fedora 43: pam_ssh 2.3-21.fc43 Β· BSD-2-Clause
- fedora 44: pam_ssh 2.3-22.fc44 Β· BSD-2-Clause
- fedora 44: pam_ssh 2.3-22.fc44 Β· BSD-2-Clause
- Copyright (c) 2001 Mark R V Murray
- Copyright (c) 2001 Networks Associates Technology, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms