{"id":2082,"date":"2021-06-10T16:00:24","date_gmt":"2021-06-10T13:00:24","guid":{"rendered":"https:\/\/www.scalahosting.com\/kb\/?p=2082"},"modified":"2025-11-27T11:45:05","modified_gmt":"2025-11-27T09:45:05","slug":"how-to-generate-an-ssh-key-pair-in-windows-using-putty","status":"publish","type":"post","link":"https:\/\/www.scalahosting.com\/kb\/how-to-generate-an-ssh-key-pair-in-windows-using-putty\/","title":{"rendered":"Generate SSH Key Windows PuTTY Guide"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\"><b>PuTTY is a very common terminal used for SSH connections for <\/b><a href=\"https:\/\/www.scalahosting.com\/blog\/what-are-the-benefits-of-windows-vps-hosting\/\"><b>Windows<\/b><\/a><b>. <\/b><span style=\"font-weight: 400;\">However, the native PuTTY application was designed to be lightweight and does not include the key generation feature needed to create the SSH key pair required.<\/span><\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><b>To <\/b><a href=\"https:\/\/www.scalahosting.com\/blog\/what-is-ssh-and-how-to-use-it\/\"><b>Generate an SSH<\/b><\/a><b> key pair to be used with PuTTY<\/b><span style=\"font-weight: 400;\">, you will need to use <\/span><b>PuTTYgen<\/b><span style=\"font-weight: 400;\">. This small application comes packaged with the PuTTY installer but needs to be accessed separately.<\/span><\/p>\n\n\n\n<h2 class=\"wp-block-heading\"><span style=\"font-weight: 400;\">Generating SSH Key Pairs with PuTTYgen<\/span><\/h2>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter\"><img decoding=\"async\" width=\"977\" height=\"527\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PuTTYgen.jpg\" alt=\"Generate SSH Key Windows PuTTY Guide, Generating SSH Key Pairs with PuTTYgen\" class=\"wp-image-2083\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PuTTYgen.jpg 977w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PuTTYgen-300x162.jpg 300w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2021\/06\/PuTTYgen-768x414.jpg 768w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n<\/div>\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 1.<\/b><span style=\"font-weight: 400;\"> In your Windows search bar, look for PuTTYgen to see if you installed it with PuTTY. If it was not, you would need to <\/span><a href=\"https:\/\/www.puttygen.com\/\" rel=\"nofollow\"><span style=\"font-weight: 400;\">download<\/span><\/a><span style=\"font-weight: 400;\"> and install it separately. When done, launch PuTTYgen.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 2.<\/b><span style=\"font-weight: 400;\"> Under the \u201cParameters\u201d label, select \u201cRSA\u201d as the type of key, then click the \u201cGenerate\u201d button. You will be asked to move your mouse around randomly &#8211; remember to do this within the small blank area under the \u201cKey\u201d label.<\/span><\/li><\/ul>\n\n\n\n<p class=\"wp-block-paragraph\"><b>Keep moving your mouse until the key information appears.&nbsp;<\/b><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 3. <\/b><span style=\"font-weight: 400;\">Type in the password you choose into the<\/span><b> \u201cKey Passphrase\u201d <\/b><span style=\"font-weight: 400;\">field and again in the <\/span><b>\u201cConfirm passphrase\u201d<\/b><span style=\"font-weight: 400;\"> field. This passphrase will be needed when making the SSH connection later.<\/span><\/li><li style=\"font-weight: 400;\" aria-level=\"1\"><b>Step 4. <\/b><span style=\"font-weight: 400;\">Save the private key on your computer. You can also save the public key, though it&#8217;s not really necessary because you can easily access it by loading the private one in PuTTYgen. If you&#8217;re going to configure your server to work with the key pair right now, it&#8217;s best to leave the PuTTYgen window open.<br><\/span><\/li><\/ul>\n\n\n\n<h2 class=\"western\" align=\"left\">Using SSH Keys For Authentication on an SPanel Server<\/h2>\n<p class=\"western\" align=\"left\">With the keys generated, you need to configure your server and your client to work with them. Here&#8217;s what you need to do if you use PuTTY to connect to an SPanel VPS.<\/p>\n<ul>\n<li class=\"western\"><b>Step 1. <\/b>Log in to your SPanel server using your username and password.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"661\" height=\"418\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/1-2.png\" alt=\"Generate SSH Key Windows PuTTY Guide, Using SSH Keys For Authentication on an SPanel Server\" class=\"wp-image-4873\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/1-2.png 661w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/1-2-300x190.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<ul>\n<li class=\"western\"><b>Step 2. <\/b>Public SSH keys used for authentication are stored in <i>~\/.ssh\/authorized_keys<\/i>. If this is the first key you&#8217;re saving on your account, you&#8217;ll need to create the file yourself.<\/li>\n<\/ul>\n<p class=\"western\" align=\"left\">Here are the commands:<\/p>\n<p class=\"western\" align=\"left\"><i><b>$ mkdir .ssh<\/b><\/i><\/p>\n<p class=\"western\" align=\"left\">and<\/p>\n<p class=\"western\" align=\"left\"><i><b>$ touch .ssh\/authorized_keys<\/b><\/i><\/p>\n<p class=\"western\" align=\"left\"><b>NOTE: <\/b>Make sure you run these commands from your account&#8217;s home directory. If you&#8217;re not sure whether you&#8217;re in the right place, you can use <i><b>$cd ~<\/b><\/i> to navigate to it.<\/p>\n<ul>\n<li class=\"western\"><b>Step 3. <\/b>Set the file&#8217;s ownership and permissions. If you skip this step, your SSH client will be unable to access your public key and log you in. The commands you need to use are:<\/li>\n<\/ul>\n<p class=\"western\" align=\"left\"><i><b>$ chmod 700 .ssh<\/b><\/i><\/p>\n<p class=\"western\" align=\"left\"><i><b>$ chmod 600 .ssh\/authorized_keys<\/b><\/i><\/p>\n<p class=\"western\" align=\"left\"><i><b>$ chown $[your username]:[your username] .ssh -R<\/b><\/i><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"661\" height=\"418\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/2-2.png\" alt=\"Generate SSH Key Windows PuTTY Guide, Using SSH Keys For Authentication on an SPanel Server 2\" class=\"wp-image-4874\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/2-2.png 661w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/2-2-300x190.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<ul>\n<li class=\"western\"><b>Step 4. <\/b>The next step is to paste your public key inside the <i>authorized_keys <\/i>file. You need to go back to the PuTTYgen window and copy your public key from the field at the top. Make sure you select every single character.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"598\" height=\"589\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/3-2.png\" alt=\"Generate SSH Key Windows PuTTY Guide, Using SSH Keys For Authentication on an SPanel Server 3\" class=\"wp-image-4875\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/3-2.png 598w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/3-2-300x295.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<p class=\"western\" align=\"left\">Now, go back to the command-line interpreter and enter the following command:<\/p>\n<p class=\"western\" align=\"left\"><i><b>$ nano .ssh\/authorized_keys<\/b><\/i><\/p>\n<p class=\"western\" align=\"left\">This opens the <i>authorized_keys <\/i>file in the GNU nano text editor. A simple right-click pastes your public key into the file. Press Ctrl+x and confirm that you want to save the changes.<\/p>\n<p class=\"western\" align=\"left\">If you want to add another public key, you need to paste it on a new line.<\/p>\n<ul>\n<li class=\"western\"><b>Step 5.<\/b> Finally, it&#8217;s time to configure PuTTY to work with the new key pair. Open the client and go to <b>SSH<\/b> &gt; <b>Auth<\/b>. Click the <b>Browse<\/b> button and select your private key.<\/li>\n<\/ul>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"565\" height=\"552\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/5-2.png\" alt=\"Generate SSH Key Windows PuTTY Guide, Using SSH Keys For Authentication on an SPanel Server 4\" class=\"wp-image-4878\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/5-2.png 565w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/5-2-300x293.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<p class=\"western\" align=\"left\">Next, you can go to the<b> Session <\/b>menu and make sure you&#8217;ve entered the correct details for the host. If you click <b>Save<\/b>, PuTTY will store the configuration, and you won&#8217;t need to select your private key every time you want to log in.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"565\" height=\"552\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/6-2.png\" alt=\"Generate SSH Key Windows PuTTY Guide, Using SSH Keys For Authentication on an SPanel Server 5\" class=\"wp-image-4879\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/6-2.png 565w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/6-2-300x293.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n\n\n\n<p class=\"western\" align=\"left\">After you click <b>Open<\/b>, PuTTY will use your private key to establish a connection to the server. If you&#8217;ve configured your key pair to use a passphrase, you&#8217;ll need to enter it at this point.<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img decoding=\"async\" width=\"661\" height=\"418\" src=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/7-2.png\" alt=\"Generate SSH Key Windows PuTTY Guide, Using SSH Keys For Authentication on an SPanel Server 6\" class=\"wp-image-4880\" srcset=\"https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/7-2.png 661w, https:\/\/www.scalahosting.com\/kb\/wp-content\/uploads\/2022\/06\/7-2-300x190.png 300w\" sizes=\"(max-width: 361px) 660px, (max-width: 767px) 89vw, (max-width: 1000px) 54vw, (max-width: 1071px) 910px, 1140px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>PuTTY is a very common terminal used for SSH connections for Windows. However, the native PuTTY application was designed to be lightweight and does not include the key generation feature needed to create the SSH key pair required. To Generate an SSH key pair to be used with PuTTY, you will need to use PuTTYgen. [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"_seopress_robots_primary_cat":"none","_seopress_titles_title":"Generate SSH Key Windows PuTTY Guide | ScalaHosting KB","_seopress_titles_desc":"","_seopress_robots_index":"","_seopress_analysis_target_kw":"","footnotes":""},"categories":[34],"tags":[],"class_list":["post-2082","post","type-post","status-publish","format-standard","hentry","category-web-hosting"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2082","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/comments?post=2082"}],"version-history":[{"count":10,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2082\/revisions"}],"predecessor-version":[{"id":5842,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/posts\/2082\/revisions\/5842"}],"wp:attachment":[{"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/media?parent=2082"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/categories?post=2082"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.scalahosting.com\/kb\/wp-json\/wp\/v2\/tags?post=2082"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}