Installing the Google Authenticator pam package alone does not configure a system for 2 Factor Authentication when connecting via SSH.
The Google Authenticator package can be installed on Ubuntu via apt-get on Ubuntu 14.04.3 and later (that I've confirmed).
It provides a pam module that allows you to prompt a user for a code generated via a Google Authenticator app or other compatible TOTP app (such as 1Password). The script below enables the authenticator prompt when using ssh and password authentication.
A few things to keep in mind:
- You cannot enable Google Authenticator for Public Key-based authentication at the same time as Password-based authentication