How to Enable Two-Factor Authentication (2FA) for SSH
With two-factor authentication, logging in via SSH requires two things: your SSH key (or your password) and a 6-digit code that changes every 30 seconds on your phone. Even if someone steals your private key, they won’t be able to log in without your phone. This guide sets it up on Ubuntu and Debian using the Google Authenticator PAM module, which works with any TOTP app, such as Google Authenticator, Aegis, or 2F…