Add two-factor authentication to your ssh in 30 seconds
Using a third-party service like authy.com has its advantages, but if you prefer, you can get two-factor authentication in the latest Ubuntu without involving a third party by installing <i>libpam-google-authenticator</i> from Ubuntu's "universe" repository.<p>Here's how you do it: first, <i>sudo apt-get install libpam-google-authenticator</i>; second, run <i>google-authenticator</i> as the user you will access remotely and follow the instructions; then, edit <i>/etc/pam.d/sshd,</i> and add "auth required pam_google_authenticator.so" in a new line; edit <i>/etc/ssh/sshd_config</i> and add (or change) the ChallengeResponseAuthentication line so it reads "ChallengeResponseAuthentication yes"; and finally, <i>sudo service ssh restart</i> to restart the ssh server.<p>More info is available from the packager of libpam-google-authenticator[1], and from the Google Authenticator PAM module's README.[2]<p>--<p>[1] <a href="http://blog.theroux.ca/security/ubuntu-2-step-authentication-with-google-authenticator/" rel="nofollow">http://blog.theroux.ca/security/ubuntu-2-step-authentication...</a><p>[2] <a href="http://code.google.com/p/google-authenticator/source/browse/libpam/README" rel="nofollow">http://code.google.com/p/google-authenticator/source/browse/...</a><p>--<p>Edits: Corrected typos; added more context.