{"id":3214,"date":"2020-01-21T17:27:45","date_gmt":"2020-01-21T16:27:45","guid":{"rendered":"http:\/\/miro.borodziuk.eu\/?p=3214"},"modified":"2020-01-21T17:29:33","modified_gmt":"2020-01-21T16:29:33","slug":"ssh-authentication-refused-bad-ownership-or-modes-for-directory","status":"publish","type":"post","link":"http:\/\/miro.borodziuk.eu\/index.php\/2020\/01\/21\/ssh-authentication-refused-bad-ownership-or-modes-for-directory\/","title":{"rendered":"SSH Authentication Refused: Bad Ownership or Modes for Directory"},"content":{"rendered":"<p>Tailing \/var\/log\/secure on the target machine is a lot more useful :<\/p>\n<pre class=\"lang:sh decode:true \">sudo tail -f \/var\/log\/secure\r\n\r\nSep 14 01:26:31 new-server sshd[22107]: Authentication refused: bad ownership or modes for directory \/home\/dave\/.ssh\r\nSep 14 01:26:46 new-server sshd[22108]: Connection closed by 98.76.54.32<\/pre>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>Finally we\u2019re getting somewhere &#8211; bad ownership or modes for directory \/home\/dave\/.ssh.<\/p>\n<p>SSH doesn\u2019t like it if your home or ~\/.ssh directories have group write permissions. Your home directory should be writable only by you, ~\/.ssh should be 700, and authorized_keys should be 600 :<\/p>\n<p>&nbsp;<\/p>\n<pre class=\"lang:sh decode:true \">\u00a0chmod g-w \/home\/your_user\r\n\u00a0chmod 700 \/home\/your_user\/.ssh\r\n\u00a0chmod 600 \/home\/your_user\/.ssh\/authorized_keys<\/pre>\n<p>&nbsp;<\/p>\n<p>You can also get around this by adding StrictModes off to your ssh_config file, but I\u2019d advise against it &#8211; fixing permissions is the way to go.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Tailing \/var\/log\/secure on the target machine is a lot more useful : sudo tail -f \/var\/log\/secure Sep 14 01:26:31 new-server sshd[22107]: Authentication refused: bad ownership or modes for directory \/home\/dave\/.ssh Sep 14 01:26:46 new-server sshd[22108]: Connection closed by 98.76.54.32 &nbsp; &nbsp; Finally we\u2019re getting somewhere &#8211; bad ownership or modes for directory \/home\/dave\/.ssh. SSH doesn\u2019t &hellip; <\/p>\n<p class=\"link-more\"><a href=\"http:\/\/miro.borodziuk.eu\/index.php\/2020\/01\/21\/ssh-authentication-refused-bad-ownership-or-modes-for-directory\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;SSH Authentication Refused: Bad Ownership or Modes for Directory&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[50],"tags":[],"_links":{"self":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3214"}],"collection":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/comments?post=3214"}],"version-history":[{"count":3,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3214\/revisions"}],"predecessor-version":[{"id":3217,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/posts\/3214\/revisions\/3217"}],"wp:attachment":[{"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/media?parent=3214"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/categories?post=3214"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/miro.borodziuk.eu\/index.php\/wp-json\/wp\/v2\/tags?post=3214"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}