ssh-rsa<\/tt> as shown in the example below.<\/p>\n\n\n\nssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDEeV\/UKOVqNUwmED8PO1E6wY3ITEbWx30rAgGudzTGnYI8fB176nlmIS+O01vaI4fMYwO9Chg3mzVT2+4AkTBm1sXnDdzhNNnkclipMXdmAHnRtzU9kREFZU0\/yyOhorzqxWBi0LQxpjTAZawi+8ysH7PGnNlX3FUObZcmHis0oD\/C7ll6DwX4WVSjh2JGcaIhbhB+sovxW5duTDqyuyKpRsbyBD0+wNjSuJFjh5MnXJqcqrEUaPRoe2wQ9k7q0K2KOXAmYYPUWrLY6N+jjYdnkyP9XWWkz6c7Qvx7m\/dBfgpyJbPryWbSZ8PsvSgtDTIND\/jNfwmgQjOCGgsZlmCsvRIixzh2uNmFCg75wyD6f\/wdZ5gq1HPFdyLblHs46P9ClfMbWJt9APx7c1SRE+qMbdLf\/5\/vNGiGHr6bBXKRX70+XODl04shFQpjm1kKkG9qHkp3bOSot4Da987dRHMhAbd0d3QdS8wCg7s6NPk4qDVnR6BCxiM2vbOD1B4gWQ8= user@server<\/pre>\n\n\n\nWhen you\u2019ve copied the public key over to the authorized keys list, save the file and exit the editor. You can now test the public key authentication by logging in to your server again. You should not get asked for your password, but instead logged straight in with the key. If it\u2019s not working, check that your private key is unlocked at your SSH Agent and try again.<\/p>\n\n\n\n
Turn off password authentication<\/h2>\n\n\n\n
With SSH key authentication configured and tested, you can disable password authentication for SSH altogether to prevent brute-forcing. When logged in to your cloud server.<\/p>\n\n\n\n
1. Open the SSH configuration file<\/strong> with the following command.<\/p>\n\n\n\nsudo nano \/etc\/ssh\/sshd_config<\/pre>\n\n\n\n2. Set the password authentication to no<\/em><\/strong> to disable clear text passwords.<\/p>\n\n\n\nPasswordAuthentication no<\/pre>\n\n\n\n3. Check that public key authentication is enabled<\/strong>, just to be safe and not get locked out from your server. If you do find yourself unable to log in with SSH, you can always use the Web terminal at your UpCloud control panel.<\/p>\n\n\n\nPubkeyAuthentication yes<\/pre>\n\n\n\nThen save and exit the editor.<\/p>\n\n\n\n
4. Restart the SSH service<\/strong> to apply the changes by using the command below.<\/p>\n\n\n\nsudo systemctl restart sshd<\/pre>\n\n\n\nWith that done your cloud server is now another step towards security. Malicious attempts to connect to your server will result in authentication rejection, as plain passwords are not allowed, and brute-forcing an RSA key is practically impossible.<\/p>\n\n\n\n
Conclusions<\/h2>\n\n\n\n
Remember to always keep your private keys safe. You can use the same key from multiple computers if you wish, or generate new ones on each client connecting to your cloud server for added security. Each user should generate their own key pair and passphrase for secure access control. With proper management, even in case one of the private keys gets compromised you won\u2019t have to replace them all.<\/p>\n","protected":false},"featured_media":27382,"comment_status":"open","ping_status":"closed","template":"","community-category":[121],"class_list":["post-24640","tutorial","type-tutorial","status-publish","has-post-thumbnail","hentry","community-category-security"],"acf":[],"_links":{"self":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/tutorial\/24640","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/tutorial"}],"about":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/types\/tutorial"}],"replies":[{"embeddable":true,"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/comments?post=24640"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/media\/27382"}],"wp:attachment":[{"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/media?parent=24640"}],"wp:term":[{"taxonomy":"community-category","embeddable":true,"href":"https:\/\/studiogo.tech\/upcloudold\/wp-json\/wp\/v2\/community-category?post=24640"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}