This article explains how to configure two-factor authentication for sudo on a Raspberry Pi using Google Authenticator.

Example PAM configuration:

auth required pam_google_authenticator.so user=root secret=/root/${USER}.google_authenticator

After configuration:

  • Enter your password
  • Enter the verification code from your authenticator app

Helpful references:

  • How-To Geek
  • Arch Linux Wiki