{"id":275,"date":"2025-12-28T19:51:02","date_gmt":"2025-12-28T18:51:02","guid":{"rendered":"https:\/\/mybox.com\/help\/?post_type=manual_kb&#038;p=275"},"modified":"2026-06-03T05:54:51","modified_gmt":"2026-06-03T03:54:51","slug":"how-do-i-add-an-ssh-key-to-a-server","status":"publish","type":"manual_kb","link":"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/","title":{"rendered":"How do I add an SSH key to a server?"},"content":{"rendered":"\n<div class=\"translation-block translation-block-merged\">\n<p class=\"wp-block-paragraph\">SSH keys provide a secure alternative to password-based authentication. Once a public key is added to your hosting account, you can connect via SSH using the corresponding private key stored on your device.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">To complete the next steps, you must have active access to SSH. Click <a href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-activate-my-ssh-account\/\" target=\"_blank\" rel=\"noreferrer noopener\">HERE<\/a> to learn how.<\/p>\n\n\n\n<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_86 ez-toc-wrap-left counter-hierarchy ez-toc-counter ez-toc-custom ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\" style=\"cursor:inherit\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><\/span><\/div>\n<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:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Step_1_Connect_to_the_Server\" >Step 1: Connect to the Server<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Step_2_Open_the_Authorized_Keys_File\" >Step 2: Open the Authorized Keys File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Step_3_Add_Your_Public_SSH_Key\" >Step 3: Add Your Public SSH Key<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Step_4_Save_the_File\" >Step 4: Save the File<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Step_5_Test_the_Connection\" >Step 5: Test the Connection<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Security_Recommendations\" >Security Recommendations<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/mybox.com\/help\/en\/knowledgebase\/how-do-i-add-an-ssh-key-to-a-server\/#Summary\" >Summary<\/a><\/li><\/ul><\/nav><\/div>\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_1_Connect_to_the_Server\"><\/span>Step 1: Connect to the Server<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<\/div>\n\n<div id=\"mybox-1103016824\" class=\"mybox-content mybox-entity-placement\"><div class=\"early-access-banner-inpost\">\r\n  <div class=\"banner-left-inpost\">\r\n    <div class=\"icon-box-inpost\">\r\n      <img decoding=\"async\" src=\"https:\/\/mybox.com\/help\/wp-content\/uploads\/2026\/02\/square-info-icon.svg\" alt=\"Info\">\r\n    <\/div>\r\n    <div class=\"text-box-inpost\">\r\n      <span class=\"label-inpost\"><span class=\"translation-block translation-block-banner-text\">Early access<\/span><\/span>\r\n      <h4><span class=\"translation-block translation-block-banner-text\">Still need help?<\/span><\/h4>\r\n      <p><span class=\"translation-block translation-block-banner-text\">Contact our customer service team.<\/span><\/p>\r\n    <\/div>\r\n  <\/div>\r\n\r\n  <div class=\"banner-right-inpost\">\r\n    <a href=\"https:\/\/panel.mybox.com\/helpdesk2\/v\/list\/\" class=\"banner-button-inpost\"><span class=\"translation-block translation-block-banner-text\">Message us<\/span><\/a>\r\n  <\/div>\r\n<\/div><\/div>\n\n<div class=\"translation-block translation-block-merged\"><p class=\"wp-block-paragraph\">Log in to your hosting account using SSH.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_2_Open_the_Authorized_Keys_File\"><\/span>Step 2: Open the Authorized Keys File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">In the terminal, run the following command:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>nano ~\/.ssh\/authorized_keys<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">If the file does not exist, it will be created automatically when saved.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_3_Add_Your_Public_SSH_Key\"><\/span>Step 3: Add Your Public SSH Key<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Paste your public SSH key on a new line in the file.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">A public key typically looks similar to:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQ...<\/code><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">Make sure the entire key is pasted on a single line without any additional characters or formatting.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have not yet generated an SSH key pair, first create one on your local computer and then copy the public key to the server.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_4_Save_the_File\"><\/span>Step 4: Save the File<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To save the changes in Nano:<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>Press <strong>Ctrl + X<\/strong><\/li>\n\n\n\n<li>Press <strong>Y<\/strong> to confirm the changes<\/li>\n\n\n\n<li>Press <strong>Enter<\/strong> to save the file<\/li>\n<\/ol>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Step_5_Test_the_Connection\"><\/span>Step 5: Test the Connection<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">After saving the file, try connecting to the server using the private key associated with the public key you added.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If the key has been configured correctly, you should be able to authenticate without entering your account password.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Security_Recommendations\"><\/span>Security Recommendations<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<ul class=\"wp-block-list\">\n<li>Never share your private SSH key.<\/li>\n\n\n\n<li>Store your private key securely on trusted devices.<\/li>\n\n\n\n<li>Remove unused keys from the <code>authorized_keys<\/code> file.<\/li>\n\n\n\n<li>Use a passphrase to protect your private key whenever possible.<\/li>\n<\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><span class=\"ez-toc-section\" id=\"Summary\"><\/span>Summary<span class=\"ez-toc-section-end\"><\/span><\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">To add an SSH key to your hosting account, connect to the server, open the <code>~\/.ssh\/authorized_keys<\/code> file, paste your public key on a new line, and save the changes. Once configured, you can use key-based authentication to access your account via SSH.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n<\/div>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"template":"","format":"standard","manualknowledgebasecat":[25,54],"manual_kb_tag":[952,1998,3421,3427,3431,3432,3619,3743,3744,3745,3746,3747,3748,3749,751,3754,752],"class_list":["post-275","manual_kb","type-manual_kb","status-publish","format-standard","hentry","manualknowledgebasecat-hosting","manualknowledgebasecat-ssh","manual_kb_tag-public-key","manual_kb_tag-server-access","manual_kb_tag-ssh-key-pair","manual_kb_tag-authorized-keys-file","manual_kb_tag-ssh-key-generation","manual_kb_tag-authorized-keys","manual_kb_tag-ssh-access","manual_kb_tag-add-ssh-key","manual_kb_tag-ssh-authorized-keys","manual_kb_tag-generate-ssh-key","manual_kb_tag-add-public-key","manual_kb_tag-nano-text-editor","manual_kb_tag-terminal-commands","manual_kb_tag-log-in-to-server","manual_kb_tag-ssh-keys","manual_kb_tag-add-ssh-public-key","manual_kb_tag-public-key-authentication"],"_links":{"self":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/275","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb"}],"about":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/types\/manual_kb"}],"author":[{"embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/users\/1"}],"version-history":[{"count":1,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/275\/revisions"}],"predecessor-version":[{"id":9515,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb\/275\/revisions\/9515"}],"wp:attachment":[{"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/media?parent=275"}],"wp:term":[{"taxonomy":"manualknowledgebasecat","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manualknowledgebasecat?post=275"},{"taxonomy":"manual_kb_tag","embeddable":true,"href":"https:\/\/mybox.com\/help\/en\/wp-json\/wp\/v2\/manual_kb_tag?post=275"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}