{"id":4702,"date":"2016-05-17T11:15:15","date_gmt":"2016-05-17T16:15:15","guid":{"rendered":"https:\/\/www.poweradmin.com\/blog\/?p=4702"},"modified":"2016-05-18T10:18:40","modified_gmt":"2016-05-18T15:18:40","slug":"enabling-publicprivate-key-ssh-authentication-on-vmware-esxi-from-windows","status":"publish","type":"post","link":"https:\/\/www.poweradmin.com\/blog\/enabling-publicprivate-key-ssh-authentication-on-vmware-esxi-from-windows\/","title":{"rendered":"Enabling Public\/Private Key SSH Authentication on VMWare ESXi from Windows"},"content":{"rendered":"<p><span style=\"font-family: verdana, geneva, sans-serif;\">Having just struggled with this for a while, I thought I\u2019d record the steps I took. \u00a0They\u2019re pretty easy once you figure them out (isn\u2019t it always that way!).<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">First, we need to enable SSH connections to our ESXi server. \u00a0In the\u00a0vSphere client, go to Security Profile. \u00a0If you don\u2019t see SSH, you can enable it by going to\u00a0Properties and then starting the service.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\"><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/enabling-ssh-in-esxi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"wp-image-4704 size-full aligncenter\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/enabling-ssh-in-esxi.png\" alt=\"enabling-ssh-in-esxi\" width=\"947\" height=\"669\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/enabling-ssh-in-esxi.png 947w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/enabling-ssh-in-esxi-300x212.png 300w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/enabling-ssh-in-esxi-768x543.png 768w\" sizes=\"auto, (max-width: 947px) 100vw, 947px\"><\/a><\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Next,\u00a0you need to generate a public\/private key pair. \u00a0The\u00a0easiest way to do this is to download PuTTYgen from\u00a0<a href=\"http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html\" target=\"_blank\" rel=\"nofollow\">http:\/\/www.chiark.greenend.org.uk\/~sgtatham\/putty\/download.html<img class=\"extlink-icon\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/plugins\/external-links-nofollow-open-in-new-tab-favicon\/images\/extlink.png\"><\/a>. \u00a0While you\u2019re there,\u00a0grab PuTTY as well.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Launch PuTTYgen. \u00a0The default SSH-2 RSA key type is good so leave that alone. \u00a0Press the Generate button to get started. \u00a0Wiggle the mouse around randomly to help it get some random data to create the keys with as shown below:<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\"><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/puttygen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter wp-image-4703 size-full\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/puttygen.png\" alt=\"puttygen\" width=\"493\" height=\"478\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/puttygen.png 493w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/puttygen-300x291.png 300w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\"><\/a><\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Once PuTTYgen has enough data, it will create some keys and show them in it\u2019s display.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">You should\u00a0save the public and private key files. \u00a0I recommend giving them a passphrase first. \u00a0Many applications (like <a href=\"https:\/\/www.poweradmin.com\/products\/server-monitoring\/?ref=blog\">PA Server Monitor<\/a>!) use keys in the OpenSSH format, so save those via the Conversions menu.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/saving-putty-keys.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4710\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/saving-putty-keys.png\" alt=\"saving-putty-keys\" width=\"493\" height=\"478\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/saving-putty-keys.png 493w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/saving-putty-keys-300x291.png 300w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\"><\/a><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Now we need to get the public key over to the ESXi server. \u00a0Run PuTTY that you also downloaded and connect to your ESXi server. \u00a0You\u2019ll need the username\/password that you connected to it with vSphere to login.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\"><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/connect-to-esxi-via-ssh-from-putty.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4705\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/connect-to-esxi-via-ssh-from-putty.png\" alt=\"connect-to-esxi-via-ssh-from-putty\" width=\"466\" height=\"449\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/connect-to-esxi-via-ssh-from-putty.png 466w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/connect-to-esxi-via-ssh-from-putty-300x289.png 300w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\"><\/a><\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">According to <a href=\"https:\/\/kb.vmware.com\/selfservice\/microsites\/search.do?language=en_US&amp;cmd=displayKC&amp;externalId=1002866\" rel=\"nofollow\" target=\"_blank\">VMWare Knowledge\u00a0Base Article\u00a01002866<img class=\"extlink-icon\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/plugins\/external-links-nofollow-open-in-new-tab-favicon\/images\/extlink.png\"><\/a>, the public key has to be copied to\u00a0<span style=\"font-family: 'courier new', courier, monospace;\">\/etc\/ssh\/keys-<em>&lt;username&gt;<\/em>\/authorized_keys<\/span><\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">So, change directory, and create the target folder as needed as shown below (I\u2019m using keys-doug because I will login as user doug)<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\"><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/mkdir-in-esxi.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4706\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/mkdir-in-esxi.png\" alt=\"mkdir-in-esxi\" width=\"502\" height=\"139\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/mkdir-in-esxi.png 502w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/mkdir-in-esxi-300x83.png 300w\" sizes=\"auto, (max-width: 502px) 100vw, 502px\"><\/a><\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Now to fire up everyone\u2019s favorite vi! \u00a0<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Type:\u00a0<span style=\"font-family: 'courier new', courier, monospace;\">vi\u00a0authorized_keys<\/span> {enter}<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">You\u2019ll see an empty vi window.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Go back to PuTTYgen and copy the Public Key<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\"><a href=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/esxi-authorized-keys-file-from-puttygen.png\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter size-full wp-image-4707\" src=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/esxi-authorized-keys-file-from-puttygen.png\" alt=\"esxi-authorized-keys-file-from-puttygen\" width=\"493\" height=\"478\" srcset=\"https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/esxi-authorized-keys-file-from-puttygen.png 493w, https:\/\/www.poweradmin.com\/blog\/wp-content\/uploads\/2016\/05\/esxi-authorized-keys-file-from-puttygen-300x291.png 300w\" sizes=\"auto, (max-width: 493px) 100vw, 493px\"><\/a><\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">In the vi window press \u2018<span style=\"font-family: 'courier new', courier, monospace;\">i<\/span>\u2018 (no quotes). \u00a0You won\u2019t see any\u00a0change, but you\u2019ve just entered \u2018insert mode\u2019. \u00a0Right-click in the window and the key you copied will get pasted.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Now type: {escape}:<span style=\"font-family: 'courier new', courier, monospace;\">wq<\/span>{enter}<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">That will (w)rite\u00a0the file and (q)uit\u00a0vi.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">You can close your PuTTY session now.<\/span><\/p>\n<p>\u00a0<\/p>\n<p><span style=\"font-family: verdana, geneva, sans-serif;\">Your ESXi server is now ready to be connected to using only a username and Public\/Private key files!<\/span><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Having just struggled with this for a while, I thought I\u2019d record the steps I took. \u00a0They\u2019re pretty easy once you figure them out (isn\u2019t it always that way!). \u00a0 First, we need to enable SSH connections to our ESXi server. \u00a0In the\u00a0vSphere client, go to Security Profile. \u00a0If you don\u2019t see SSH, you can [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":4703,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-4702","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general-it"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts\/4702","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/comments?post=4702"}],"version-history":[{"count":5,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts\/4702\/revisions"}],"predecessor-version":[{"id":4715,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/posts\/4702\/revisions\/4715"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/media\/4703"}],"wp:attachment":[{"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/media?parent=4702"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/categories?post=4702"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.poweradmin.com\/blog\/wp-json\/wp\/v2\/tags?post=4702"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}