SSH Woes with Vagrant, Windows, and AWS

Dumping this here in case anyone has a similar problem.

I was trying to use Vagrant to spin up dev boxes on aws. Every time I got to the rysnc part of my day, I got the error “Warning: Unprotected Private Key File, this private key will be ignored.”

I googled a bunch and got a lot of really unhelpful answers, mostly dealing with UNIX-like environments. I also tried messing with the Windows file permissions. Fail all around. Here’s how I finally solved it:

Step 1: Install Cygwin Terminal. Find private key and look at it

$ ls -la
drwxrwx---+ 1 kellb_000      None      0 Jun 25 12:51 .
drwxrwx---+ 1 Administrators SYSTEM    0 Jun 25 13:11 ..
-rw-rw----+ 1 kellb_000      None   1696 Jun 25 12:50 Vagrant.pem

Step 2: Chmod file to something more restrictive.

$ chmod 400 Vagrant.pem
$ ls -la
drwxrwx---+ 1 kellb_000      None      0 Jun 25 12:51 .
drwxrwx---+ 1 Administrators SYSTEM    0 Jun 25 13:11 ..
-r--r-----+ 1 kellb_000      None   1696 Jun 25 12:50 Vagrant.pem

Gee that’s odd, that gave it 440, not the 400 I asked for. Oh, hm, it doesn’t have a group. That’s odd. Let’s give it one and try again.

$ chgrp SYSTEM Vagrant.pem
$ chmod 400 Vagrant.pem
drwxrwx---+ 1 kellb_000      None      0 Jun 25 12:51 .
drwxrwx---+ 1 Administrators SYSTEM    0 Jun 25 13:11 ..
-r--------+ 1 kellb_000      SYSTEM 1696 Jun 25 12:50 Vagrant.pem

Much better. I then tried bringing up the vagrant box, and success! At least, until it failed for entirely unrelated reasons. Hooray.

Filed under: Hacking, Programming

One thought on “SSH Woes with Vagrant, Windows, and AWS

  1. Tim says:

    I love Vagrant, but it’s still fairly cumbersome.

    And when you need to upgrade to a newer Vagrant version? Flush some hours goodbye while you try to get your local env back up to how it was.

    All in all, still way better than the other options!

Leave a Reply

Your email address will not be published. Required fields are marked *