PAM_GOOGLE_AUTHENTICATOR(8)
π PAM_GOOGLE_AUTHENTICATOR π
okay bestie, welcome to pam_google_authenticator(8), the section-8 manual page for the Google Authenticator PAM module. it's the lil guy that gives your login a second factor, and honestly? iconic. let's get into it π«Ά
β¨ NAME β¨
pam_google_authenticator β the PAM module for Google two-factor authentication. two factors, one module, zero chill. π
πΈ SYNOPSIS πΈ
pam_google_authenticator.so [secret=file] [authtok_prompt=prompt]
[user=username] [no_strict_owner] [allowed_perm=0nnn] [debug]
[try_first_pass|use_first_pass|forward_pass] [noskewadj] [no_increment_hotp] [nullok] [echo_verification_code]
π¦ DESCRIPTION π¦
so the pam_google_authenticator module is literally designed to protect user authentication with a second factor β either time-based (TOTP) or counter-based (HOTP). before you log in, the user gets asked for BOTH their password and a one-time code. no skipping steps, no sneaking in π
those one-time codes can be generated with the Google Authenticator application, installed on the user's Android device. and to generate + verify those codes, a secret key (randomly generated, no cap) has to be shared between the device that makes the one-time codes and the system where this PAM module is enabled. it's giving long-distance relationship but make it cryptography π
depending on its config (peep the options section, bestie), this module requires that a secret file is manually set up for each account on the system. that secret file holds the secret key AND the user-specific options (see google-authenticator(1)). unless you use the nullok option, authentication tries get rejected if that secret file doesn't exist. alternatively, a system administrator can create those secret files on behalf of the users and then justβ¦ tell them the secret keys. main character sysadmin energy π
π OPTIONS π
secret=fileβ point the module at a non-standard file location for the secret file.- by default, the PAM module looks for the secret file in the
.google_authenticatorfile inside the home of the user logging in. this option overrides that location. periodt. - the location you hand over may include these short-hands:
${USER}β gets interpreted as the username.${HOME}and~β get interpreted as the user's home directory.
- by default, the PAM module looks for the secret file in the
authtok_prompt=promptβ override the default token prompt.- heads up bestie: if there are spaces in the prompt you provide, the whole argument must be wrapped in square brackets.
user=usernameβ switch to a hard-coded user prior to doing any file operation. set it and forget it.no_strict_ownerβ disable the check against the secret file's owner.- by default, the secret file must be owned by the user logging in. this option turns that check off.
allowed_perm=0nnnβ override the checked permissions of the secret file.- by default, the secret file must be readable only by its owner (ie. mode
0600). this option lets you specify a different mode for this file.
- by default, the secret file must be readable only by its owner (ie. mode
debugβ enable more verbose log messages insyslog. for when you need to see everything πtry_first_pass|use_first_pass|forward_passβ stacking options for this PAM module.- because some PAM clients literally cannot prompt the user for more than just the password, these stacking options exist:
try_first_pass: before prompting the user for the one-time code, this module first tries the previous stacked module's password, in case that satisfies this module as well.use_first_pass: force this module to use a previous stacked module's password. with this option, this module will never prompt the user for the one-time code. so if no valid one-time code is available, the user gets denied access. bye πforward_pass: query the user for both the system password and the verification code in a single prompt. the system password is then forwarded to the next PAM module, which will have to be configured with either theuse_first_passoption, or thetry_first_passoption.
- because some PAM clients literally cannot prompt the user for more than just the password, these stacking options exist:
noskewadjβ don't adjust time skew automatically.- by default, the PAM module makes an attempt to compensate for time skew between the server and the device on which one-time passcodes are generated. this option disables that behavior.
- note that this option is only relevant for time-based (TOTP) mode.
no_increment_hotpβ don't increment the counter for failed attempts.- in some circonstance, failed passwords still get an OTP prompt. this option disables counter incrementation in such situations.
- note that this option is only relevant for counter-based (HOTP) mode.
nullokβ allow users to log in without OTP, if they haven't set up OTP yet.- during the initial roll-out process, not all users may have created a secret key yet. this option lets them log in anyway, even if the secret file doesn't exist. very forgiving of you π
echo_verification_codeβ echo the verification code when it is entered by the user.
π MODULE TYPE PROVIDED π
only the auth module type is provided. that's it. that's the whole list. one and done. slay.
π RETURN VALUES π
PAM_SUCCESSβ either the provided one-time code is correct, or it's a valid emergency code. we love a win β¨PAM_IGNOREβ this module is ignored.PAM_AUTH_ERRβ the provided one-time code isn't correct and isn't a valid emergency code, or an error was encountered. it's giving rejected π
π EXAMPLES π
these lines may be used to enable this PAM module, bestie:
auth required pam_google_authenticator.so no_increment_hotp# Make sure the counter (for HOTP mode) isn't incremented for failed attempts.auth required pam_google_authenticator.so nullok# Allow users to log in if their secret files don't existauth required pam_google_authenticator.so secret=/var/unencrypted-home/${USER}/.google_authenticator# Store secret files in a specific locationauth required pam_google_authenticator.so [authtok_prompt=Your secret token: ]# Use a specific promptauth required pam_google_authenticator.so noskewadj# Don't compensate time skew automatically
π₯ SECURITY NOTES π₯
for highest security, make sure that both password and one-time code are being requested even if the password and/or the one-time code are incorrect. that means at least the first of pam_unix.so (or whatever other module is used to verify passwords) and pam_google_authenticator.so should be set as required, not requisite. this one matters, don't skip it, iykyk π«Ά
β SEE ALSO β
google-authenticator(1).- the Google Authenticator source code and all documentation may be downloaded from <https://github.com/google/google-authenticator-libpam>. go get it, bestie π§
and that's the whole page!! this was the Google Authenticator PAM module manual, page PAM_GOOGLE_AUTHENTICATOR(8) β ty for reading, you ate πβ¨π
π¦ where this page comes from
- alpine 3.24: google-authenticator-doc 1.11-r0 Β· Apache-2.0
- arch rolling: libpam-google-authenticator 1.11-1 Β· Apache
- debian bookworm: libpam-google-authenticator 20191231-2
- debian trixie: libpam-google-authenticator 20191231-2.1
- epel 10: google-authenticator 1.11-1.el10_1 Β· Apache-2.0
- epel 9: google-authenticator 1.09-5.el9 Β· ASL 2.0
- fedora 43: google-authenticator 1.11-3.fc43 Β· Apache-2.0
- fedora 44: google-authenticator 1.11-4.fc44 Β· Apache-2.0
- opensuse-leap 16.0: google-authenticator-libpam 1.10-bp160.1.12 Β· Apache-2.0
- opensuse-leap 16.0: google-authenticator-libpam 1.10-bp160.1.12 Β· Apache-2.0
- opensuse-leap 16.0: google-authenticator-libpam 1.10-bp160.1.12 Β· Apache-2.0
- opensuse-leap 16.0: google-authenticator-libpam 1.10-bp160.1.12 Β· Apache-2.0
- ubuntu jammy: libpam-google-authenticator 20191231-2
- ubuntu noble: libpam-google-authenticator 20191231-2build1
- ubuntu questing: libpam-google-authenticator 20250213-1.11-0.1
- ubuntu resolute: libpam-google-authenticator 20250213-1.11-0.1build1 Β· Apache-2.0
- ubuntu stonking: libpam-google-authenticator 20250213-1.11-0.1build1 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms