{"id":2433,"date":"2021-08-26T10:02:28","date_gmt":"2021-08-26T10:02:28","guid":{"rendered":"https:\/\/teza.blog\/?p=2433"},"modified":"2021-08-26T10:02:59","modified_gmt":"2021-08-26T10:02:59","slug":"unprotected-private-key-file","status":"publish","type":"post","link":"https:\/\/teza.blog\/index.php\/2021\/08\/26\/unprotected-private-key-file\/","title":{"rendered":"Unprotected Private Key File"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>Warning: Permanently added '192.168.1.1' (RSA) to the list of known hosts.\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\n@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@\nPermissions 0644 for '\/path\/to\/my\/key.pem' are too open.\nIt is required that your private key files are NOT accessible by others.\nThis private key will be ignored.\nbad permissions: ignore key: \/path\/to\/my\/key.pem\nPermission denied (publickey).\n<\/code><\/pre>\n\n\n\n<p>It&#8217;s a common error to see when trying to log in to a server via SSH, and it has a relatively easy fix. But before we get to that, let&#8217;s get some background on why this error shows up.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"whyamiseeingthiserror\">Why am I seeing this Error?<\/h3>\n\n\n\n<p>What happened is the key you&#8217;re trying to use (key.pem in the example above) is too accessible to users on the system.<\/p>\n\n\n\n<p>This is a bad thing because then you&#8217;re not the only one able to use the key, which defeats the purpose. Private keys should only be accessible to one user.<\/p>\n\n\n\n<p>For example, if an attacker somehow gains access to any of the accounts on your system, then they&#8217;d be able access the key, as opposed to having to get access to your account specifically. This gives them too many opportunities to get to the private key.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"howcanifixit\">How can I fix it?<\/h3>\n\n\n\n<p>Like I said earlier, this is an easy fix. Just run:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>$ sudo chmod 600 \/path\/to\/my\/key.pem\n<\/code><\/pre>\n\n\n\n<p>Or if you are running gui, locate the pem file, right click and change the permissions as per below. <br><br><\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"604\" height=\"385\" src=\"https:\/\/teza.blog\/wp-content\/uploads\/2021\/08\/image-1.png\" alt=\"\" class=\"wp-image-2468\" srcset=\"https:\/\/teza.blog\/wp-content\/uploads\/2021\/08\/image-1.png 604w, https:\/\/teza.blog\/wp-content\/uploads\/2021\/08\/image-1-300x191.png 300w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/figure>\n\n\n\n<p>That should do the job. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>It&#8217;s a common error to see when trying to log in to a server via SSH, and it has a relatively easy fix. But before we get to that, let&#8217;s get some background on why this error shows up. Why am I seeing this Error? What happened is the key you&#8217;re trying to use (key.pem &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/teza.blog\/index.php\/2021\/08\/26\/unprotected-private-key-file\/\" class=\"read-more\">Read More<span class=\"screen-reader-text\"> &#8220;Unprotected Private Key File&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[81,82,45],"tags":[],"class_list":["post-2433","post","type-post","status-publish","format-standard","hentry","category-cloud","category-linux","category-technology"],"_links":{"self":[{"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/posts\/2433","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/comments?post=2433"}],"version-history":[{"count":2,"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/posts\/2433\/revisions"}],"predecessor-version":[{"id":2469,"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/posts\/2433\/revisions\/2469"}],"wp:attachment":[{"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/media?parent=2433"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/categories?post=2433"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/teza.blog\/index.php\/wp-json\/wp\/v2\/tags?post=2433"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}