gpr
11/23/2017 - 9:09 AM

Setup Google Authenticator for SSH

This README describe how to setup sshd and pam to authorize people to login through ssh if they have either a valid publickey or a valid password AND they have a valid google authenticator code.

README

Install the PAM module

sudo apt install libpam-google-authenticator

Enable google-authenticator for your sessions:

google-authenticator

Save securely your backup password.

Enable two-factor authentication in SSH

Edit /etc/pam.d/sshd by adding the following line above @include common-auth

auth sufficient pam_google_authenticator.so

Edit /etc/ssh/sshd_config by modifying the following options:

PubkeyAuthentication yes
PasswordAuthentication yes
ChallengeResponseAuthentication yes
AuthenticationMethods publickey,keyboard-interactive password,keyboard-interactive
UsePAM yes