{"id":125375,"date":"2025-12-02T16:21:44","date_gmt":"2025-12-02T16:21:44","guid":{"rendered":"\/my\/tutorials\/how-to-disable-ssh-password-login-on-vps"},"modified":"2026-03-10T10:02:55","modified_gmt":"2026-03-10T10:02:55","slug":"how-to-disable-ssh-password-login-on-vps","status":"publish","type":"post","link":"\/my\/tutorials\/how-to-disable-ssh-password-login-on-vps","title":{"rendered":"SSH disable password login: securing your Linux VPS"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><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 authenticating with SSH keys is a better option.<\/p><p>In this tutorial you will learn how to disable password authentication for SSH on Linux VPS.<\/p><p class=\"has-text-align-center\"><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<\/p><h2 class=\"wp-block-heading\" id=\"h-what-you-ll-need\">What You&rsquo;ll Need<\/h2><p>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>Before we start the guide, <a href=\"\/my\/tutorials\/ssh\/how-to-set-up-ssh-keys\">configure the SSH key<\/a> on your server. If you skip this step and disable password authentication right away, you&rsquo;ll have a hard time connecting to your server because you won&rsquo;t have an active method to authenticate your session.<\/p><p><div class=\"protip\">\n                    <h4 class=\"title\">&#128161; Pro tip<\/h4>\n                    <p>If you use a <a href=\"\/my\/vps-hosting\">VPS plan from Hostinger<\/a>, ask <strong>Kodee AI Assistant<\/strong> to verify whether you've added SSH key authentication. Simply type a question like \"What SSH public keys are installed on my VPS?\" If it gives you a list of keys, then you know SSH key authentication is set up correctly.<\/p>\n                <\/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>Proceed with this only if you have completed <strong>Step 1<\/strong> and successfully connected to your VPS using SSH keys 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=\"\/my\/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>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>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><?xml encoding=\"utf-8\" ?><figure class=\"wp-block-image size-large\"><a href=\"\/my\/vps-hosting\" target=\"_blank\" rel=\"noreferrer noopener\"><img decoding=\"async\" width=\"1024\" height=\"300\" src=\"https:\/\/www.hostinger.com\/tutorials\/wp-content\/uploads\/sites\/2\/2023\/02\/VPS-hosting-banner-1024x300.png\" alt=\"\" class=\"wp-image-77934\" srcset=\"https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner.png 1024w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-300x88.png 300w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/2023\/02\/VPS-hosting-banner-150x44.png 150w, https:\/\/www.hostinger.com\/my\/tutorials\/wp-content\/uploads\/sites\/45\/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=\"\/my\/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":"","rank_math_description":"","rank_math_focus_keyword":"","footnotes":""},"categories":[22643,22639],"tags":[],"class_list":["post-125375","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":0},{"locale":"pt-BR","link":"https:\/\/www.hostinger.com\/br\/tutoriais\/desabilitar-acesso-com-senha-ssh","default":0},{"locale":"en-UK","link":"https:\/\/www.hostinger.com\/uk\/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},{"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-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-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}],"_links":{"self":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/125375","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/users\/27"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/comments?post=125375"}],"version-history":[{"count":0,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/posts\/125375\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/media?parent=125375"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/categories?post=125375"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hostinger.com\/my\/tutorials\/wp-json\/wp\/v2\/tags?post=125375"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}