{"id":35647,"date":"2021-03-05T11:33:00","date_gmt":"2021-03-05T17:33:00","guid":{"rendered":"https:\/\/www.rosehosting.com\/blog\/?p=35647"},"modified":"2022-06-03T03:32:13","modified_gmt":"2022-06-03T08:32:13","slug":"how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04","status":"publish","type":"post","link":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/","title":{"rendered":"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04"},"content":{"rendered":"<div id=\"bsf_rt_marker\"><\/div>\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"742\" height=\"372\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png\" alt=\"how to set up multi-factor authentication for ssh on ubuntu 20.04\" class=\"wp-image-35812\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png 742w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04-300x150.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04-150x75.png 150w\" sizes=\"(max-width: 742px) 100vw, 742px\" \/><\/figure>\n\n\n\n<p>SSH is a &#8220;Secure Shell Protocol&#8221; used to connect and manage remote Linux systems securely over an unsecured network. It is very useful for system administrators to perform day-to-day tasks on the remote server. So securing an SSH server is an essential part of any system administrator. <\/p>\n\n\n\n<p>By default, you can connect to SSH with a password or using the private key. That means, it is only a single factor authentication. So it is a good idea to implement multi-factor authentication in the SSH server to add an extra layer of security. In multi-factor authentication, you will need to provide your system user password and another password generated on a mobile device. This will significantly enhance your server&#8217;s security.<\/p>\n\n\n\n<!--more-->\n\n\n\n<p>In this tutorial, we will show you how to set up multi-factor authentication for SSH on Ubuntu 20.04 VPS.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_82_2 counter-hierarchy ez-toc-counter ez-toc-transparent ez-toc-container-direction\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<label for=\"ez-toc-cssicon-toggle-item-69f880ed6ce00\" class=\"ez-toc-cssicon-toggle-label\"><span class=\"ez-toc-cssicon\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/label><input type=\"checkbox\"  id=\"ez-toc-cssicon-toggle-item-69f880ed6ce00\"  aria-label=\"Toggle\" \/><nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#Prerequisites\" >Prerequisites<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#Step-1-Log-in-to-the-Server-Update-the-Server-OS-Packages\" >Step 1: Log in to the Server &amp; Update the Server OS Packages<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#Step-2-Install-Google-Authenticator\" >Step 2: Install Google Authenticator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#Step-3-Install-Google-Authenticator-Application\" >Step 3: Install Google Authenticator Application<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#Step-4-Configure-SSH-to-Use-Google-Authenticator\" >Step 4: Configure SSH to Use Google Authenticator<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#Step-5-Test-Two-Factor-Authentication\" >Step: 5 Test Two Factor Authentication<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\" id=\"h-prerequisites\"><span class=\"ez-toc-section\" id=\"Prerequisites\"><\/span>Prerequisites<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\"><li>An Ubuntu 20.04 VPS (we\u2019ll be using our SSD 2 <a href=\"https:\/\/www.rosehosting.com\/linux-vps-hosting\/\">VPS plan<\/a>)<\/li><li>Access to the root user account (or access to an admin account with root privileges)<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-1-log-in-to-the-server-update-the-server-os-packages\"><span class=\"ez-toc-section\" id=\"Step-1-Log-in-to-the-Server-Update-the-Server-OS-Packages\"><\/span>Step 1: Log in to the Server &amp; Update the Server OS Packages<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>First, log in to your Ubuntu 20.04 server via SSH as the root user:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ssh root@IP_Address -p Port_number<\/pre>\n\n\n\n<p>You will need to replace &#8216;IP_Address&#8217; and &#8216;Port_number&#8217; with your server\u2019s respective IP address and SSH port number. Additionally, replace &#8216;root&#8217; with the username of the admin account if necessary.<\/p>\n\n\n\n<p>Before starting, you have to make sure that all Ubuntu OS packages installed on the server are up to date. You can do this by running the following commands:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get update -y\napt-get upgrade -y<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-2-install-google-authenticator\"><span class=\"ez-toc-section\" id=\"Step-2-Install-Google-Authenticator\"><\/span>Step 2: Install Google Authenticator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>We will use Google Authenticator for multi-factor authentication. So, you will need to install the Google Authenticator PAM module to your system. You can install it by running the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">apt-get install libpam-google-authenticator -y<\/pre>\n\n\n\n<p>Once the package has been installed, run the Google Authenticator using the following command:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">google-authenticator<\/pre>\n\n\n\n<p>During the installation, you will be asked the following question:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Do you want authentication tokens to be time-based (y\/n) y\nWarning: pasting the following URL into your browser exposes the OTP secret to Google:\n  https:\/\/www.google.com\/chart?chs=200x200&chld=M|0&cht=qr&chl=otpauth:\/\/totp\/root@ubuntu2004%3Fsecret%3D4XXQ2QA6FRV72SDM2JWSZTQJE4%26issuer%3D\n<\/pre>\n\n\n\n<p>Press <strong>y<\/strong> and hit <strong>Enter<\/strong> to continue. You should see a QR code in the following screen:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"938\" height=\"714\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/set-up-ssh-two-factor-authentication-2fa-on-ubuntu-server.png\" alt=\"set up ssh two factor authentication (2fa) on ubuntu server\" class=\"wp-image-35671\" title=\"set up ssh two factor authentication (2FA) on ubuntu server\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/set-up-ssh-two-factor-authentication-2fa-on-ubuntu-server.png 938w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/set-up-ssh-two-factor-authentication-2fa-on-ubuntu-server-300x228.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/set-up-ssh-two-factor-authentication-2fa-on-ubuntu-server-150x114.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/set-up-ssh-two-factor-authentication-2fa-on-ubuntu-server-768x585.png 768w\" sizes=\"(max-width: 938px) 100vw, 938px\" \/><\/figure>\n\n\n\n<p>Answer all questions and hit <strong>Enter<\/strong> to finish the process as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Do you want to disallow multiple uses of the same authentication\ntoken? This restricts you to one login about every 30s, but it increases\nyour chances to notice or even prevent man-in-the-middle attacks (y\/n) y\n\nBy default, a new token is generated every 30 seconds by the mobile app.\nIn order to compensate for possible time-skew between the client and the server,\nwe allow an extra token before and after the current time. This allows for a\ntime skew of up to 30 seconds between authentication server and client. If you\nexperience problems with poor time synchronization, you can increase the window\nfrom its default size of 3 permitted codes (one previous code, the current\ncode, the next code) to 17 permitted codes (the 8 previous codes, the current\ncode, and the 8 next codes). This will permit for a time skew of up to 4 minutes\nbetween client and server.\nDo you want to do so? (y\/n) y\n\nIf the computer that you are logging into isn't hardened against brute-force\nlogin attempts, you can enable rate-limiting for the authentication module.\nBy default, this limits attackers to no more than 3 login attempts every 30s.\nDo you want to enable rate-limiting? (y\/n) If the computer that you are logging into isn't hardened against brute-force\nlogin attempts, you can enable rate-limiting for the authentication module.\nBy default, this limits attackers to no more than 3 login attempts every 30s.\nDo you want to enable rate-limiting? (y\/n) y\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-3-install-google-authenticator-application\"><span class=\"ez-toc-section\" id=\"Step-3-Install-Google-Authenticator-Application\"><\/span>Step 3: Install Google Authenticator Application<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Next, you will need to install the Google Authenticator application on your smartphone. Once installed, open Google Authenticator on your mobile and scan the above QR code. Once the QR code is scanned, you should see a six-digit one-time password on your phone as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"576\" height=\"1024\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/enable-ssh-on-ubuntu-20.04-step-by-step-instruction.jpg\" alt=\"enable ssh on ubuntu 20.04 step by step instruction\" class=\"wp-image-35674\" title=\"enable ssh on ubuntu 20.04 step by step instructions.\" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/enable-ssh-on-ubuntu-20.04-step-by-step-instruction.jpg 576w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/enable-ssh-on-ubuntu-20.04-step-by-step-instruction-169x300.jpg 169w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/enable-ssh-on-ubuntu-20.04-step-by-step-instruction-84x150.jpg 84w\" sizes=\"(max-width: 576px) 100vw, 576px\" \/><\/figure>\n\n\n\n<p>This password will expire within 30 seconds, So you will need to open Google Authenticator Application and see new a password in order to log in to the Ubuntu server via SSH.<\/p>\n\n\n\n<p>You can also see the secret key, verification code and emergency scratch code in the above output. It is recommended to save it to a safe place for later use.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">Your new secret key is: 4XXQ2QA6FRV72SDM2JWSZTQJE4\nYour verification code is 423832\nYour emergency scratch codes are:\n  96469497\n  84504151\n  61871048\n  79931657\n  71052210\n<\/pre>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-4-configure-ssh-to-use-google-authenticator\"><span class=\"ez-toc-section\" id=\"Step-4-Configure-SSH-to-Use-Google-Authenticator\"><\/span>Step 4: Configure SSH to Use Google Authenticator<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>Next, you will also need to configure SSH to use Google Authenticator. You can configure it by editing the file \/etc\/ssh\/sshd_config:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/ssh\/sshd_config<\/pre>\n\n\n\n<p>Change the following lines:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">UsePAM yes\nChallengeResponseAuthentication yes\n<\/pre>\n\n\n\n<p>Save and close the file when you are finished. Then, restart the SSH service to apply the configuration:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">systemctl restart sshd<\/pre>\n\n\n\n<p>Next, you will need to edit \/etc\/pam.d\/sshd file and define PAM rules for SSH service:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">nano \/etc\/pam.d\/sshd<\/pre>\n\n\n\n<p>Add the following line after <strong>@include common-auth<\/strong> :<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">auth required pam_google_authenticator.so\n<\/pre>\n\n\n\n<p>Save and close the file.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"h-step-5-test-two-factor-authentication\"><span class=\"ez-toc-section\" id=\"Step-5-Test-Two-Factor-Authentication\"><\/span>Step: 5 Test Two Factor Authentication<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p>At this point, Your SSH server is now configured with multi-factor authentication. It&#8217;s time to connect it and test it.<\/p>\n\n\n\n<p>On the remote system, open your terminal and login to your server via SSH as shown below:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ssh root@ssh-server-ip<\/pre>\n\n\n\n<p>You will be asked to provide your system password and Verification code generate by Google Authenticator. Provide your system password shown in the Google Authenticator App and hit <strong>Enter<\/strong> to login to the server as shown below:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" width=\"1002\" height=\"240\" src=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-configure-two-factor-authentication-on-a-ubuntu-server.png\" alt=\"how to configure two-factor authentication on a ubuntu server\" class=\"wp-image-35677\" title=\"how to configure two-factor authentication on a ubuntu server. \" srcset=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-configure-two-factor-authentication-on-a-ubuntu-server.png 1002w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-configure-two-factor-authentication-on-a-ubuntu-server-300x72.png 300w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-configure-two-factor-authentication-on-a-ubuntu-server-150x36.png 150w, https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-configure-two-factor-authentication-on-a-ubuntu-server-768x184.png 768w\" sizes=\"(max-width: 1002px) 100vw, 1002px\" \/><\/figure>\n\n\n\n<p>Congratulations! your SSH server is now secured with multi-factor authentication..<\/p>\n\n\n\n<p>Of course, you don\u2019t have to set up multi-factor authentication for SSH on Ubuntu VPS if you use one of our <a href=\"https:\/\/rosehosting.com\/managed-vps-hosting.html\">Managed Hosting services<\/a>, in which case you can simply ask our expert Linux admins to set up multi-factor authentication for SSH on Ubuntu, for you. They are available 24\u00d77 and will take care of your request immediately.<\/p>\n\n\n\n<p>PS. If you liked this post on how to set up multi-factor authentication for SSH on Ubuntu, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>SSH is a &#8220;Secure Shell Protocol&#8221; used to connect and manage remote Linux systems securely over an unsecured network. It &#8230; <\/p>\n<p class=\"read-more-container\"><a title=\"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\" class=\"read-more button\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#more-35647\" aria-label=\"Read more about Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\">Read More<\/a><\/p>\n","protected":false},"author":4,"featured_media":35812,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1703,1698],"tags":[68,59,1839],"class_list":["post-35647","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-security","category-ubuntu","tag-ssh","tag-ubuntu","tag-ubuntu-20-04","generate-columns","tablet-grid-50","mobile-grid-100","grid-parent","grid-33"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.5 (Yoast SEO v27.5) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04<\/title>\n<meta name=\"description\" content=\"Here&#039;s a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\" \/>\n<meta property=\"og:description\" content=\"Here&#039;s a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/\" \/>\n<meta property=\"og:site_name\" content=\"RoseHosting\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/RoseHosting\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/rosehosting.helpdesk\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-05T17:33:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2022-06-03T08:32:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png?v=1616006749\" \/>\n\t<meta property=\"og:image:width\" content=\"742\" \/>\n\t<meta property=\"og:image:height\" content=\"372\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Jeff Wilson\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:title\" content=\"How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\" \/>\n<meta name=\"twitter:description\" content=\"Here&#039;s a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.\" \/>\n<meta name=\"twitter:creator\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:site\" content=\"@rosehosting\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeff Wilson\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/\"},\"author\":{\"name\":\"Jeff Wilson\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\"},\"headline\":\"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\",\"datePublished\":\"2021-03-05T17:33:00+00:00\",\"dateModified\":\"2022-06-03T08:32:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/\"},\"wordCount\":732,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png\",\"keywords\":[\"ssh\",\"ubuntu\",\"Ubuntu 20.04\"],\"articleSection\":[\"Security\",\"Ubuntu\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/\",\"name\":\"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png\",\"datePublished\":\"2021-03-05T17:33:00+00:00\",\"dateModified\":\"2022-06-03T08:32:13+00:00\",\"description\":\"Here's a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2021\\\/02\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png\",\"width\":742,\"height\":372,\"caption\":\"how to set up multi-factor authentication for ssh on ubuntu 20.04\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"name\":\"RoseHosting.com\",\"description\":\"Premium Linux Tutorials Since 2001\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#organization\",\"name\":\"RoseHosting\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"contentUrl\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/03\\\/android-chrome-192x192-1.png\",\"width\":192,\"height\":192,\"caption\":\"RoseHosting\"},\"image\":{\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/RoseHosting\",\"https:\\\/\\\/x.com\\\/rosehosting\",\"https:\\\/\\\/www.linkedin.com\\\/in\\\/rosehosting\\\/\"],\"description\":\"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.\",\"email\":\"info@rosehosting.com\",\"telephone\":\"(314) 275-0414\",\"legalName\":\"Rose Web Services LLC\",\"foundingDate\":\"2001-04-02\",\"numberOfEmployees\":{\"@type\":\"QuantitativeValue\",\"minValue\":\"11\",\"maxValue\":\"50\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/#\\\/schema\\\/person\\\/7ce77a842fa6a9a7f8efa186f2353713\",\"name\":\"Jeff Wilson\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g\",\"caption\":\"Jeff Wilson\"},\"description\":\"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.\",\"sameAs\":[\"https:\\\/\\\/www.rosehosting.com\",\"https:\\\/\\\/www.facebook.com\\\/rosehosting.helpdesk\"],\"url\":\"https:\\\/\\\/www.rosehosting.com\\\/blog\\\/author\\\/jwilson\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04","description":"Here's a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/","og_locale":"en_US","og_type":"article","og_title":"How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04","og_description":"Here's a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.","og_url":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/","og_site_name":"RoseHosting","article_publisher":"https:\/\/www.facebook.com\/RoseHosting","article_author":"https:\/\/www.facebook.com\/rosehosting.helpdesk","article_published_time":"2021-03-05T17:33:00+00:00","article_modified_time":"2022-06-03T08:32:13+00:00","og_image":[{"width":742,"height":372,"url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png?v=1616006749","type":"image\/png"}],"author":"Jeff Wilson","twitter_card":"summary_large_image","twitter_title":"How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04","twitter_description":"Here's a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.","twitter_creator":"@rosehosting","twitter_site":"@rosehosting","twitter_misc":{"Written by":"Jeff Wilson","Est. reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#article","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/"},"author":{"name":"Jeff Wilson","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713"},"headline":"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04","datePublished":"2021-03-05T17:33:00+00:00","dateModified":"2022-06-03T08:32:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/"},"wordCount":732,"commentCount":0,"publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png","keywords":["ssh","ubuntu","Ubuntu 20.04"],"articleSection":["Security","Ubuntu"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/","url":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/","name":"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04","isPartOf":{"@id":"https:\/\/www.rosehosting.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#primaryimage"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#primaryimage"},"thumbnailUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png","datePublished":"2021-03-05T17:33:00+00:00","dateModified":"2022-06-03T08:32:13+00:00","description":"Here's a quick guide on How to Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04. Click here for a step-by-step guide.","breadcrumb":{"@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#primaryimage","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2021\/02\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20.04.png","width":742,"height":372,"caption":"how to set up multi-factor authentication for ssh on ubuntu 20.04"},{"@type":"BreadcrumbList","@id":"https:\/\/www.rosehosting.com\/blog\/how-to-set-up-multi-factor-authentication-for-ssh-on-ubuntu-20-04\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.rosehosting.com\/blog\/"},{"@type":"ListItem","position":2,"name":"Set Up Multi-Factor Authentication for SSH on Ubuntu 20.04"}]},{"@type":"WebSite","@id":"https:\/\/www.rosehosting.com\/blog\/#website","url":"https:\/\/www.rosehosting.com\/blog\/","name":"RoseHosting.com","description":"Premium Linux Tutorials Since 2001","publisher":{"@id":"https:\/\/www.rosehosting.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.rosehosting.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.rosehosting.com\/blog\/#organization","name":"RoseHosting","url":"https:\/\/www.rosehosting.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","contentUrl":"https:\/\/www.rosehosting.com\/blog\/wp-content\/uploads\/2022\/03\/android-chrome-192x192-1.png","width":192,"height":192,"caption":"RoseHosting"},"image":{"@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/RoseHosting","https:\/\/x.com\/rosehosting","https:\/\/www.linkedin.com\/in\/rosehosting\/"],"description":"RoseHosting is a leading Linux hosting provider, serving thousands of clients world-wide since 2001.","email":"info@rosehosting.com","telephone":"(314) 275-0414","legalName":"Rose Web Services LLC","foundingDate":"2001-04-02","numberOfEmployees":{"@type":"QuantitativeValue","minValue":"11","maxValue":"50"}},{"@type":"Person","@id":"https:\/\/www.rosehosting.com\/blog\/#\/schema\/person\/7ce77a842fa6a9a7f8efa186f2353713","name":"Jeff Wilson","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/0985fed6af04cc60703d2ecf27c65dfa373e0ca00eb21c0b03477e099ea3f99f?s=96&r=g","caption":"Jeff Wilson"},"description":"An experienced Linux veteran with many years of experience. Helping other Linux admins with frequent Linux and business-related blog posts on the RoseHosting blog. Techie by choice. Loving nature and travel. Happily married and father of two lovely children.","sameAs":["https:\/\/www.rosehosting.com","https:\/\/www.facebook.com\/rosehosting.helpdesk"],"url":"https:\/\/www.rosehosting.com\/blog\/author\/jwilson\/"}]}},"_links":{"self":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/35647","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/comments?post=35647"}],"version-history":[{"count":15,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/35647\/revisions"}],"predecessor-version":[{"id":44273,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/posts\/35647\/revisions\/44273"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media\/35812"}],"wp:attachment":[{"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/media?parent=35647"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/categories?post=35647"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.rosehosting.com\/blog\/wp-json\/wp\/v2\/tags?post=35647"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}