SSH to use two-factor authentication using Google Authenticator on Debian or Ubuntu Server

  • A computer running Ubuntu 16.04 LTS or above
  • A phone running Android or iOS
  • A configured SSH connection
  • You should understand the danger of stolen passwords.
  • You don’t need to know what two-factor authentication is and how it works. 🙂

Installing and configuring required packages

Start a terminal session and type:

sudo apt install libpam-google-authenticator

Configuring SSH

To make SSH use the Google Authenticator PAM module, add the following line to the /etc/pam.d/sshd file:

Read more

Share