{"id":1210,"date":"2013-08-04T03:38:37","date_gmt":"2013-08-04T03:38:37","guid":{"rendered":"http:\/\/ubuntuhandbook.org\/?p=1210"},"modified":"2013-08-04T03:38:37","modified_gmt":"2013-08-04T03:38:37","slug":"install-setup-google-authenticator-in-ubuntu-13-04-12-04","status":"publish","type":"post","link":"https:\/\/ubuntuhandbook.org\/index.php\/2013\/08\/install-setup-google-authenticator-in-ubuntu-13-04-12-04\/","title":{"rendered":"Install \/ Setup Google Authenticator in Ubuntu 13.04, 12.04"},"content":{"rendered":"<p>This simple tutorial is going to show you how to <b>install and setup Google Authenticator to secure your Ubuntu SSH<\/b> remote login by two-factor authentication.<\/p>\n<p>Google provides this application for various smartphone platforms. With it, you can secure your account by logging in with a frequently-changing authentication code. So far, I&#8217;m using this in WordPress Login, Ubuntu Server SSH Login, Linode VPS Login. As I know, <a href=\"http:\/\/en.wikipedia.org\/wiki\/Google_Authenticator\" target=\"_blank\">Google Authenticator<\/a> also works on Amazon Web Services, App.net, Dropbox, and more.<\/p>\n<h3>Install Google Authenticator in Ubuntu:<\/h3>\n<p>Since Ubuntu 12.04 Precise, the Google Authenticator PAM module is available in the universe repository by default. Just open Ubuntu Software Center, search for and install <b>libpam-google-authenticator<\/b> package<\/p>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-ubuntu.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-ubuntu.jpg\" alt=\"google authenticator ubuntu\" width=\"468\" height=\"209\" class=\"aligncenter size-full wp-image-1211\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-ubuntu.jpg 468w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-ubuntu-300x133.jpg 300w\" sizes=\"auto, (max-width: 468px) 100vw, 468px\" \/><\/a><\/p>\n<p>Once installed, press <b>Ctrl+Alt+T<\/b> to open terminal. Run below command to create a key and display a QR code which you can scan using the smartphone app. The emergency codes can be used when you don\u2019t have your phone.<\/p>\n<pre>google-authenticator<\/pre>\n<p><a href=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-secret-key.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-secret-key-300x205.jpg\" alt=\"google authenticator secret key\" width=\"300\" height=\"205\" class=\"aligncenter size-medium wp-image-1212\" srcset=\"https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-secret-key-300x205.jpg 300w, https:\/\/ubuntuhandbook.org\/wp-content\/uploads\/2013\/08\/google-authenticator-secret-key.jpg 773w\" sizes=\"auto, (max-width: 300px) 100vw, 300px\" \/><\/a><\/p>\n<p><b>To enable two-step authentication for SSH login<\/b>, add the line &#8220;auth required pam_google_authenticator.so&#8221; (witout quotes) into <b>\/etc\/pam.d\/sshd<\/b>. To do so, run below command in terminal:<\/p>\n<pre>sudo sh -c 'echo \"auth required pam_google_authenticator.so\" >> \/etc\/pam.d\/sshd'<\/pre>\n<p>Also add the line &#8220;ChallengeResponseAuthentication yes&#8221; (without quotes) to <b>\/etc\/ssh\/sshd_config<\/b>, you can do it by running below command:<\/p>\n<pre>sudo sh -c 'echo \"ChallengeResponseAuthentication yes\" >> \/etc\/ssh\/sshd_config'<\/pre>\n<p>Finally restart SSH service on Ubuntu:<\/p>\n<pre>sudo \/etc\/init.d\/ssh restart<\/pre>","protected":false},"excerpt":{"rendered":"<p>This simple tutorial is going to show you how to install and setup Google Authenticator to secure your Ubuntu SSH remote login by two-factor authentication. Google provides this application for various smartphone platforms. With it, you can secure your account by logging in with a frequently-changing authentication code. So far, I&#8217;m using this in WordPress [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[388,17,15,37],"class_list":["post-1210","post","type-post","status-publish","format-standard","hentry","category-ubuntu-server-2","tag-google-authenticator-in-ubuntu","tag-ubuntu-12-04","tag-ubuntu-13-04","tag-ubuntu-13-10"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/1210","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/comments?post=1210"}],"version-history":[{"count":0,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/posts\/1210\/revisions"}],"wp:attachment":[{"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/media?parent=1210"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/categories?post=1210"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ubuntuhandbook.org\/index.php\/wp-json\/wp\/v2\/tags?post=1210"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}