{"id":667,"date":"2016-10-15T00:00:00","date_gmt":"2016-10-15T00:00:00","guid":{"rendered":"http:\/\/blog.hostinger.io\/hostinger-tutorials\/uncategorized\/vpshow-to-disable-ssh-password-authentication-on-vps\/"},"modified":"2025-04-23T09:19:13","modified_gmt":"2025-04-23T09:19:13","slug":"how-to-disable-ssh-password-login-on-vps","status":"publish","type":"post","link":"\/uk\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","title":{"rendered":"SSH Disable Password Login: Securing Your Linux VPS"},"content":{"rendered":"<p class=\"wp-block-paragraph\">The majority of people use password authentication to connect to their servers via SSH command line and do not even consider that this authentication method may not be as safe as they expected. Consider this: if any hacker manages to collect your SSH password, all of your valuable information is at risk. That is why authenticating with SSH keys is a better option.<\/p><p class=\"wp-block-paragraph\">In this tutorial you will learn how to disable password authentication for SSH on Linux VPS.<\/p><p class=\"has-text-align-center wp-block-paragraph\"><a href=\"https:\/\/assets.hostinger.com\/content\/tutorials\/pdf\/SSH-Cheat-Sheet-EN.pdf\" target=\"_blank\" rel=\"noopener\">Download ultimate SSH commands cheat sheet<\/a><\/p><p>\n\n\n\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-what-you-ll-need\">What You&rsquo;ll Need<\/h2><p class=\"wp-block-paragraph\">Before you begin this guide you&rsquo;ll need the following:<\/p><ul class=\"wp-block-list\">\n<li>A working Linux OS based server \/ VPS<\/li>\n\n\n\n<li>Root access to your server \/ VPS via SSH command line<\/li>\n<\/ul><h2 class=\"wp-block-heading\" id=\"h-step-1-configuring-ssh-key-authentication-on-your-server\">Step 1 &mdash; Configuring SSH Key Authentication on Your Server<\/h2><p class=\"wp-block-paragraph\">Before we start the guide, you should note that if you do not set up another authentication method beforehand and disable password authentication right away, you will have a hard time connecting to your server.<br><\/p><p>\n\n\n<div class=\"announcement-block announcement-block--important\">\n            <span class=\"announcement-block__heading\">\n                <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\">\n                    <path fill-rule=\"evenodd\" clip-rule=\"evenodd\"\n                          d=\"M12 22.5C17.799 22.5 22.5 17.799 22.5 12C22.5 6.20101 17.799 1.5 12 1.5C6.20101 1.5 1.5 6.20101 1.5 12C1.5 17.799 6.20101 22.5 12 22.5ZM13.637 7.65198C13.637 6.74791 12.9041 6.01501 12 6.01501C11.0959 6.01501 10.363 6.74791 10.363 7.65198C10.5335 9.53749 10.875 13.383 10.875 13.383C10.875 14.0043 11.3787 14.508 12 14.508C12.6213 14.508 13.125 14.0043 13.125 13.383V13.38L13.637 7.65198ZM11.9927 15.714C11.3714 15.714 10.8677 16.2177 10.8677 16.839C10.8677 17.4603 11.3714 17.964 11.9927 17.964H12.0073C12.6286 17.964 13.1323 17.4603 13.1323 16.839C13.1323 16.2177 12.6286 15.714 12.0073 15.714H11.9927Z\"\n                          fill=\"#FEA419\"\/>\n                <\/svg>\n                Important\n            <\/span>\n            <p class=\"announcement-block__content\">\n                <strong>Important!<\/strong> Configure another way of authentication before you proceed with this guide. We recommend <a href=\"\/uk\/tutorials\/ssh\/how-to-set-up-ssh-keys\/\">SSH Key authentication<\/a>. Continue with this tutorial only after you configure your SSH Keys because you may be locked out of your own server.\n            <\/p><\/div>\n\n\n\n<\/p><h2 class=\"wp-block-heading\" id=\"h-step-2-editing-ssh-configuration-file\">Step 2 &mdash; Editing SSH configuration file<\/h2><p class=\"wp-block-paragraph\">Proceed with this only if you have completed <strong>Step 1<\/strong> and successfully connected to your VPS using [<a href=\"\/uk\/tutorials\/ssh\/how-to-set-up-ssh-keys\/\">SSH keys<\/a>] because you may be locked out of your own server.<\/p><ol class=\"wp-block-list\">\n<li>Connect to your server\/VPS with root SSH credentials.<\/li>\n\n\n\n<li>Open <strong>\/etc\/ssh\/sshd_config<\/strong> configuration file with a text editor like <strong>nano<\/strong> or <strong>vim<\/strong> via SSH command line. <code>nano \/etc\/ssh\/sshd_config<\/code><\/li>\n\n\n\n<li>When editor opens you should see a similar view:<br><img decoding=\"async\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/03\/disable-ssh-password-auth01.png\" alt=\"sshd config\"><\/li>\n\n\n\n<li>Now you need to find a line: <code>PasswordAuthentication yes<\/code>. <a href=\"\/uk\/tutorials\/how-to-install-and-use-nano-text-editor\/\">Nano<\/a> has a search feature so you can simply search for this line by pressing <strong>CTRL + W<\/strong> on your keyboard, writing a search keyword <code>PasswordAuthentication<\/code> and clicking <strong>Enter<\/strong>.<br><img decoding=\"async\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/03\/disable-ssh-password-auth02.png\" alt=\"nano search password authentication\"><\/li>\n\n\n\n<li>Your pointer should point to the necessary area.<br><img decoding=\"async\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/03\/disable-ssh-password-auth03.png\" alt=\"find password authentication area\"><\/li>\n\n\n\n<li>And here you need to change <code>PasswordAuthentication yes<\/code> to <code>PasswordAuthentication no<\/code>:<br><img decoding=\"async\" src=\"\/tutorials\/wp-content\/uploads\/sites\/2\/2017\/03\/disable-ssh-password-auth04.png\" alt=\"change password authentication method\"><\/li>\n\n\n\n<li>To save changes and exit press <strong>Ctrl + X<\/strong>, type in <strong>Y<\/strong> and press <strong>Enter<\/strong> button.<\/li>\n\n\n\n<li>Additionally, you need to restart the <strong>SSHD<\/strong> service to apply the changes. Run the following command: <code>service sshd restart<\/code><\/li>\n<\/ol><p class=\"wp-block-paragraph\">And that is it! SSH password authentication has been disabled. From this point no one will be able to connect to your server \/ VPS using SSH password. Only privileged users who have their SSH keys added to your server will be able to connect.<\/p><h2 class=\"wp-block-heading\" id=\"h-conclusion\">Conclusion<\/h2><p class=\"wp-block-paragraph\">You have learned how to disable SSH password authentication on your server \/ VPS. This makes your server a lot safer because no one will be able to connect to your server via SSH using a password. Only privileged users using SSH keys or other advanced authentication methods will be able to connect.<\/p><figure class=\"wp-block-image size-large\"><a href=\"\/uk\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/imagedelivery.net\/LqiWLm-3MGbYHtFuUbcBtA\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner.png\/w=1024,h=1024,fit=scale-down\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/uk\/tutorials\/wp-content\/uploads\/sites\/51\/2023\/02\/VPS-hosting-banner-768x225.png 768w\" sizes=\"(max-width: 1024px) 100vw, 1024px\" \/><\/a><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>The majority of people use password authentication to connect to their servers via SSH command line and do not even consider that this authentication method may not be as safe as they expected. Consider this: if any hacker manages to collect your SSH password, all of your valuable information is at risk. That is why [&#8230;]<\/p>\n<p><a class=\"btn btn-secondary understrap-read-more-link\" href=\"\/uk\/tutorials\/how-to-disable-ssh-password-login-on-vps\/\">Read More&#8230;<\/a><\/p>\n","protected":false},"author":27,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"rank_math_title":"How to Disable SSH Password Authentication on Linux VPS","rank_math_description":"Allowing password authentication on your server might not be safe. In this tutorial you will learn how to disable SSH password authentication on Linux.","rank_math_focus_keyword":"","footnotes":""},"categories":[22644,22640],"tags":[],"class_list":["post-667","post","type-post","status-publish","format-standard","hentry","category-managing-monitoring-and-security","category-vps"],"hreflangs":[{"locale":"en-US","link":"https:\/\/www.hostinger.com\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":1},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/desabilitar-acesso-com-senha-ssh\/","default":0},{"locale":"en-PH","link":"https:\/\/www.hostinger.com\/ph\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"en-MY","link":"https:\/\/www.hostinger.com\/my\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"en-GB","link":"https:\/\/www.hostinger.com\/uk\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"en-IN","link":"https:\/\/www.hostinger.com\/in\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"en-CA","link":"https:\/\/www.hostinger.com\/ca\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"en-AU","link":"https:\/\/www.hostinger.com\/au\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"en-NG","link":"https:\/\/www.hostinger.com\/ng\/tutorials\/how-to-disable-ssh-password-login-on-vps\/","default":0},{"locale":"pt-PT","link":"https:\/\/www.hostinger.com\/pt\/tutoriais\/desabilitar-acesso-com-senha-ssh\/","default":0}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/667","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/comments?post=667"}],"version-history":[{"count":7,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/667\/revisions"}],"predecessor-version":[{"id":105052,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/posts\/667\/revisions\/105052"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/media?parent=667"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/categories?post=667"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/uk\/tutorials\/wp-json\/wp\/v2\/tags?post=667"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}