{"id":1244,"date":"2011-01-26T11:00:20","date_gmt":"2011-01-26T10:00:20","guid":{"rendered":"http:\/\/t-machine.org\/?p=1244"},"modified":"2011-01-26T11:00:20","modified_gmt":"2011-01-26T10:00:20","slug":"safe-login-on-os-x-using-an-ssh-key-from-a-usb-keythumbdrive","status":"publish","type":"post","link":"http:\/\/new.t-machine.org\/index.php\/2011\/01\/26\/safe-login-on-os-x-using-an-ssh-key-from-a-usb-keythumbdrive\/","title":{"rendered":"Safe login on OS X: using an SSH key from a USB key\/thumbdrive"},"content":{"rendered":"<p>I like computer security to be EASY and SECURE.<\/p>\n<p>I hate passwords, and I use them rarely if at all. Instead, I use digital keys as much as possible (i.e. something based on a physical key stored on a removable USB drive that I take with me wherever I go). Like using a physical key, it&#8217;s much easier.<\/p>\n<p>Sadly, OS X has a version of SSH that tries to be &#8220;too clever&#8221; while actually being &#8220;annoyingly unhelpful&#8221;. If you attempt to use a key from a removable drive, you get this error message:<\/p>\n<blockquote><p>\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br \/>\n@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @<br \/>\n@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@<br \/>\nPermissions 0777 for &#8216;login-key-for-tmachine.ssh&#8217; are too open.<br \/>\nIt is recommended that your private key files are NOT accessible by others.<br \/>\nThis private key <em><strong>will be ignored.<\/strong><\/em><br \/>\nbad permissions: ignore key: (key-name)<br \/>\nPermission denied (publickey).\n <\/p><\/blockquote>\n<p>(emphasis mine).<\/p>\n<p>While it&#8217;s delightfully verbose, and tells you exactly what&#8217;s happened, it&#8217;s also a bit misleading. It says &#8220;WARNING&#8221; when it actually means &#8220;ERROR&#8221;, since the ssh system at this point deliberately stops itself. But, more importantly, it&#8217;s an error that you cannot evade under OS X. With OS X, all removable media has &#8220;Permissions 0777&#8221;.<\/p>\n<p>Fortunately, there&#8217;s a workaround. Using <a href=\"http:\/\/glyph.twistedmatrix.com\/2009\/02\/using-ssh-keys-on-usb-drive-on-macos-x.html\">this good but not-quite-detailed-enough article<\/a>, I got most of the way there.<\/p>\n<p>I had two problems, things that article omits.<\/p>\n<p>Firstly, you are no longer &#8220;allowed&#8221; to edit \/etc\/fstab on OS X. Don&#8217;t try it. Instead, there&#8217;s a new command-line editor called &#8220;vifs&#8221; (hmm. vi-for-fstab, perhaps? :)) which works fine.<\/p>\n<p>Secondly, the USB Drive I&#8217;m using has a space in the Label name. \/etc\/fstab uses spaces as a reserved character (I knew this), but &#8230; what do you write instead? (I didn&#8217;t know this).<\/p>\n<p>I tried (and failed with):<\/p>\n<ol>\n<li>&#8220;My Drive&#8221;\n<li>My\\ Drive\n<li>My Drive\n<\/ol>\n<p>&#8230;and with some creative googling, eventually found an example fstab with spaces in a label name. Aha!<\/p>\n<ol>\n<li>My\\040Drive\n<\/ol>\n<p>i.e. replace spaces with &#8220;\\040&#8221; (I&#8217;m guessing because it&#8217;s so low-level they&#8217;ve decided to &#8220;assume&#8221; unicode in all escape sequences)<\/p>\n<p>&#8230;and now it all works as intended. Yay.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I like computer security to be EASY and SECURE. I hate passwords, and I use them rarely if at all. Instead, I use digital keys as much as possible (i.e. something based on a physical key stored on a removable USB drive that I take with me wherever I go). Like using a physical key, [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6,45],"tags":[],"_links":{"self":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1244"}],"collection":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/comments?post=1244"}],"version-history":[{"count":0,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/posts\/1244\/revisions"}],"wp:attachment":[{"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/media?parent=1244"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/categories?post=1244"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/new.t-machine.org\/index.php\/wp-json\/wp\/v2\/tags?post=1244"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}