{"data":{"external_id":1449,"slug":"how-to-turn-off-ssh-password-authentication","title":"How do I disable SSH password authentication?","content":"If you have set up your Linux server to authenticate using an SSH key, it is recommended to completely disable password authentication. This greatly reduces the attack surface for your server.\nManually via SSH\nDisabling password authentication is actually quite simple. Open the configuration file \/etc\/ssh\/sshd_config with a text editor (e.g. nano).\nFind the line\n#PasswordAuthentication yes\nRemove the &#8222;#&#8220; in this line. Replace &#8222;yes&#8220; with &#8222;no&#8220; at the end, so it should read:\nPasswordAuthentication no\nSave the file and restart the SSH server. You can do this with the command:\nservice ssh restart\nKeep the current SSH session open and open a new session in a new window. Now, try to log in using the SSH key. If it doesn&#8217;t work, you should re-enable password authentication and resolve this issue.\nUsing the web interface\nIn the Cloud Manager, you can easily enable or disable password authentication in the VPS settings.\nGo to the &#8222;SSH&#8220; tab and select the option &#8222;SSH Key Only&#8220; for &#8222;Root Login&#8220;.\nLogin with SSH Key only. Disable password authentication.\nAfter saving, your server will only allow root login with an SSH key.\nI have locked myself out of SSH\nIf you have locked yourself out, you can always connect to your server using VNC. There you can also use the root password, as it is not an SSH connection but a direct terminal connection. Otherwise, our support team is always available to assist you.","schema":null,"facts":[],"links":[{"type":"faq","url":"https:\/\/support.prepaid-hoster.de\/faq\/de\/virtuelle-server\/wie-kann-ich-mich-per-vnc-verbinden.html","data":{"post_id":"56525","post_slug":"wie-kann-ich-mich-per-vnc-verbinden","post_cat_id":"9"}}]}}