{"id":127,"date":"2024-05-03T10:23:29","date_gmt":"2024-05-03T08:23:29","guid":{"rendered":"https:\/\/tomas.varhaug.net\/?p=127"},"modified":"2024-05-03T10:23:29","modified_gmt":"2024-05-03T08:23:29","slug":"2fa-setup-for-ubuntu","status":"publish","type":"post","link":"https:\/\/tomas.varhaug.net\/?p=127","title":{"rendered":"2FA setup for Ubuntu"},"content":{"rendered":"\n<p>STEP 1: HAVE AN AUTHENTICATOR APP ON YOUR PHONE<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Installing and configuring required packages<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>apt-get install libpam-google-authenticator<\/code><\/pre>\n\n\n\n<p><strong>Configuring PAM SSH module<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/pam.d\/sshd<\/code><\/pre>\n\n\n\n<p>ADD TO TOP (after @include common-auth):<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>auth required pam_google_authenticator.so<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Configuring SSH Service<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>vim \/etc\/ssh\/sshd_config<\/code><\/pre>\n\n\n\n<p>CHANGE:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ChallengeResponseAuthentication yes<\/code><\/pre>\n\n\n\n<p>ADD (if you want public_key ONLY) :<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>AuthenticationMethods publickey,keyboard-interactive<\/code><\/pre>\n\n\n\n<p>RESTART SSH:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>systemctl restart sshd.service<\/code><\/pre>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\"\/>\n\n\n\n<p><strong>Running the Google Authenticator<\/strong><\/p>\n\n\n\n<p>Run to create OTP code:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>google-authenticator\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code>Make tokens \u201ctime-base\u201d\u201d: yes<br>Update the .google_authenticator file: yes<br>Disallow multiple uses: yes<br>Increase the original generation time limit: no<br>Enable rate-limiting: yes<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>STEP 1: HAVE AN AUTHENTICATOR APP ON YOUR PHONE Installing and configuring required packages Configuring PAM SSH module ADD TO TOP (after @include common-auth): Configuring SSH Service CHANGE: ADD (if you want public_key ONLY) : RESTART SSH: Running the Google Authenticator Run to create OTP code:<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[13,10],"class_list":["post-127","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-linux","tag-ubuntu"],"_links":{"self":[{"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=\/wp\/v2\/posts\/127","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=127"}],"version-history":[{"count":6,"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions"}],"predecessor-version":[{"id":133,"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=\/wp\/v2\/posts\/127\/revisions\/133"}],"wp:attachment":[{"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=127"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=127"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/tomas.varhaug.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=127"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}