Enabling Vagrant SSH on Windows

Picture of old shoesDevOps tools like VirtualBox and Vagrant are the kind of tools that can make you feel like we’re able to cast off the boundaries of mortal realities and take our place among the stars.  That giddy feeling quickly wares-off however when you try your new powers on a window machine and, not so surprisingly, things don’t quiet work as smoothly as they do on Linux or OS X.

VirtualBox and Vagrant themselves install just fine on my Window 8 rig, and building a box and bringing it up works just fine as well, but things come to a screeching halt when you need to SSH into your running VM as windows just doesn’t have a functional SSH client at command line.  As most windows users will likely guess here comes Putty to the rescue, but it will need a bit of work.

My robot masters at Google eventually let me to a chain of threads that helped me work out how to connect Putty to vagrant and use the SSH key.   The gist of what needs to be done is:

  • The vagrant multi-putty plugin needs to be installed.
  • The directory with the Putty executable needs to be added to the Windows Path.
  • The vagrant private key in your %HOME%/.vagrant.d/insecure_private_key needs to be converted and saved to ppk format and with the ppk extension by puttygen.

So quickly

Install the vagrant multi-putty plugin, from your windows cmd line type:

> vagrant plugin install vagrant-multi-putty

Then add the directory with your putty executable to your PATH (Google it hippies)

Then vagrant generates a private key to use for ‘vagrant ssh’ in your user directory under %HOME%/.vagrant.d/insecure_private_key.  You need to download and open puttygen.exe and select ‘load’, navigating to the directory above and opening the key.  It will convert it to *.ppk format and you need to save the private key with the .ppk extension.

After that just ‘vagrant up’ on whatever box you want and type:

> vagrant putty

and you should be in!