{"id":4268,"date":"2018-04-21T22:26:40","date_gmt":"2018-04-21T22:26:40","guid":{"rendered":"https:\/\/geekdecoder.com\/?p=4268"},"modified":"2018-04-21T22:26:40","modified_gmt":"2018-04-21T22:26:40","slug":"how-to-create-ssh-keys-with-putty-to-connect-to-centos7","status":"publish","type":"post","link":"https:\/\/www.qbytes.cloud\/index.php\/2018\/04\/21\/how-to-create-ssh-keys-with-putty-to-connect-to-centos7\/","title":{"rendered":"How To Create SSH Keys With PuTTY to Connect to CentOS7"},"content":{"rendered":"<p>Generating OpenSSH-compatible Keys for Use with PuTTY<\/p>\n<p>To generate a set of RSA keys with PuTTYgen:<\/p>\n<ol>\n<li>Start the PuTTYgen utility, by double-clicking on its .exe file;<\/li>\n<li>For Type of key to generate, select RSA;<\/li>\n<li>In the Number of bits in a generated key field, specify either 2048 or 4096 (increasing the bits makes it harder to crack the key by brute-force methods);<\/li>\n<li>Click the Generate button;<\/li>\n<li>Move your mouse pointer around in the blank area of the Key section, below the progress bar (to generate some randomness) until the progress bar is full;<\/li>\n<li>A private\/ public key pair has now been generated;<\/li>\n<li>In the Key comment field, enter any comment you&#8217;d like, to help you identify this key pair, later (e.g. your e-mail address; home; office; etc.) &#8212; the key comment is particularly useful in the event you end up creating more than one key pair;<\/li>\n<li>Optional: Type a passphrase in the Key passphrase field &amp; re-type the same passphrase in the Confirm passphrase field (if you would like to use your keys for automated processes, however, you should not create a passphrase);<\/li>\n<li>Click the Save public key button &amp; choose whatever filename you&#8217;d like (some users create a folder in their computer named my_keys);<\/li>\n<li>Click the Save private key button &amp; choose whatever filename you&#8217;d like (you can save it in the same location as the public key, but it should be a location that only you can access and that you will NOT lose! If you lose your keys and have disabled username\/password logins, you will no longer be able log in!);<\/li>\n<li>Right-click in the text field labeled Public key for pasting into OpenSSH authorized_keys file and choose Select All;<br \/>\nRight-click again in the same text field and choose Copy.<\/li>\n<li>NOTE: PuTTY and OpenSSH use different formats for public SSH keys. If the SSH Key you copied starts with &#8220;&#8212;- BEGIN SSH2 PUBLIC KEY &#8230;&#8221;, it is in the wrong format. Be sure to follow the instructions carefully. Your key should start with &#8220;ssh-rsa AAAA &#8230;.&#8221;<\/li>\n<li>Save The Public Key On The Server<\/li>\n<\/ol>\n<p><!--more--><\/p>\n<p>Now, you need to paste the copied public key in the file ~\/.ssh\/authorized_keys on your server.<\/p>\n<p>Log in to your destination server; see How to Log Into Your Droplet with PuTTY (for windows users)<br \/>\nIf your SSH folder does not yet exist, create it manually:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">mkdir ~\/.ssh\nchmod 0700 ~\/.ssh\ntouch ~\/.ssh\/authorized_keys\nchmod 0644 ~\/.ssh\/authorized_keys\n\n<\/pre>\n<p>Paste the SSH public key into your ~\/.ssh\/authorized_keys file (see Installing and Using the Vim Text Editor on an Cloud Server):<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">nano ~\/.ssh\/authorized_keys\n\n<\/pre>\n<ol>\n<li>Create a PuTTY Profile to Save Your Server&#8217;s Settings<br \/>\nIn PuTTY, you can create (and save) profiles for connections to your various SSH servers, so you don&#8217;t have to remember, and continually re-type, redundant information.<\/li>\n<li>Start PuTTY by double-clicking its executable file;<\/li>\n<li>PuTTY&#8217;s initial window is the Session Category (navigate PuTTY&#8217;s various categories, along the left-hand side of the window);<\/li>\n<li>In the Host Name field, enter the IP address of your VPS or its fully qualified domain name (FQDN);<\/li>\n<li>Enter the port number in the Port field (for added security, consider changing your server&#8217;s SSH port to a non-standard port.<\/li>\n<li>Select SSH under Protocol;<\/li>\n<li>Along the left-hand side of the window, select the Data sub-category, under Connection;<\/li>\n<li>Specify the username that you plan on using, when logging in to the SSH server, and whose profile you&#8217;re saving, in the Auto-login username field;<\/li>\n<li>Expand the SSH sub-category, under Connection;<\/li>\n<li>Highlight the Auth sub-category and click the Browse button, on the right-hand side of the PuTTY window;<\/li>\n<li>Browse your file system and select your previously-created private key;<\/li>\n<li>Return to the Session Category and enter a name for this profile in the Saved Sessions field, e.g. user@123.456.78.9 or user@host.yourdomain.tld;<\/li>\n<li>Click the Save button for the Load, Save or Delete a stored session area.<\/li>\n<li>Now you can go ahead and log in to user@1.2.3.4 and you will not be prompted for a password. However, if you had set a passphrase on your public key, you will be asked to enter the passphrase at that time (and every time you log in, in the future).<\/li>\n<\/ol>\n<p>Disable Username\/Password Logins<\/p>\n<p>Once you have verified that your key-based logins are working, you may elect to disable username\/password logins to achieve better security. To do this, you need to edit your SSH server&#8217;s configuration file. On Debian\/ Ubuntu systems, this file is located at \/etc\/ssh\/sshd_config.<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">nano \/etc\/ssh\/sshd_config\n\n<\/pre>\n<p>Edit the lines, referenced below:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">&#x5B;...]\nPasswordAuthentication no\n&#x5B;...]\nUsePAM no\n&#x5B;...]\n\n<\/pre>\n<p>Save the file. Now, reload the SSH server&#8217;s configuration:<\/p>\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">sudo reload ssh\n\n<\/pre>\n<p>Need More Help?<\/p>\n<ul>\n<li>Need Help with a technical problem? <a href=\"https:\/\/qbytes.cloud\/submit-ticket\/\">Submit a Support Ticket.<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Generating OpenSSH-compatible Keys for Use with PuTTY To generate a set of RSA keys with PuTTYgen: Start the PuTTYgen utility, by double-clicking on its .exe file; For Type of key to generate, select RSA; In the Number of bits in a generated key field, specify either 2048 or 4096 (increasing the bits makes it harder &#8230; <a title=\"How To Create SSH Keys With PuTTY to Connect to CentOS7\" class=\"read-more\" href=\"https:\/\/www.qbytes.cloud\/index.php\/2018\/04\/21\/how-to-create-ssh-keys-with-putty-to-connect-to-centos7\/\" aria-label=\"Read more about How To Create SSH Keys With PuTTY to Connect to CentOS7\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[110],"tags":[],"class_list":["post-4268","post","type-post","status-publish","format-standard","hentry","category-ssh"],"_links":{"self":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4268","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/comments?post=4268"}],"version-history":[{"count":0,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/posts\/4268\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/media?parent=4268"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/categories?post=4268"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.qbytes.cloud\/index.php\/wp-json\/wp\/v2\/tags?post=4268"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}