finds.dev

google/google-authenticator-libpam

Google Authenticator PAM module

View on GitHub

★ 2,017CApache-2.0updated Feb 2026

// the take

This is the PAM module Google wrote to bolt TOTP/HOTP two-factor auth onto SSH or any other PAM-aware login path, plus the `google-authenticator` CLI that provisions a user's secret and QR code. It's for sysadmins who want 2FA on Linux boxes without standing up a separate auth server — the kind of thing you still see in cloud-init scripts a decade after it shipped.

Correctly implements RFC 4226 (HOTP) and RFC 6238 (TOTP) rather than rolling its own scheme, and handles the annoying edge cases (clock skew compensation, counter resync) that trip up naive implementations. The `secret=` and `user=` options let you relocate the secrets file for encrypted-home setups or daemon accounts, which is a real operational need most 2FA PAM modules ignore. It has an actual unit test (`pam_google_authenticator_unittest.c`) alongside the PAM glue, and the `grace_period` IP-tracking feature is a pragmatic way to avoid prompting on every SSH multiplexed connection.

Secrets and lockout state live in a plain file in the user's home directory (`~/.google_authenticator`) with no central store, so it doesn't scale cleanly to fleets of servers or HA setups without you building your own sync/replication layer on top. Several options are flagged `DANGEROUS` in the docs themselves (`no_strict_owner`, `allow_readonly`) because they trade away the one-time-password guarantee for operational convenience, and it's easy to end up with a config that silently weakens security. There's no hardware token (FIDO/WebAuthn) or push-based second factor here — it's TOTP/HOTP only, so if you want modern passkey-style auth you're looking elsewhere. Account recovery is entirely manual: lose your phone and you're editing the secrets file or regenerating it, there's no backup-code workflow baked in.

We read the README, the directory tree and a key source file in October 2026. Nobody pays to be listed. How we judge →

// at a glance

Stars
2,017
Forks
301
Language
C
License
Apache-2.0
Last commit
27 Feb 2026

// nearby

If google-authenticator-libpam isn't quite it.

All repos →