Connect to Your Vagrant Virtual Machine with PuTTY

RobertCvn edited this page Jan 19, 2015 · 5 revisions

The Secure Shell ("SSH") protocol is all about security and Vagrant is prepackaged with an SSH key. Unfortunately, PuTTY is not compatible with OpenSSH, out-of-the-box. Consequently, PuTTY will not recognize the insecure_private_key (which is in OpenSSH format) provided by Vagrant as a valid, private key.

The file is named insecure_private_key only because it is not very private, in that it is publicly available, because it ships with Vagrant. You can regain the security offered by the SSH protocol by creating your own SSH key pair and editing the Vagrantfile, accordingly.

A workaround is to use PuTTYgen (a free, open-source RSA and DSA key generation utility) to import and convert the insecure_private_key into PuTTY's format (a .ppk file). To do so, simply: 1. Open the PuTTYgen utility; 1. Click on the Load button; 1. Navigate to the ...\.vagrant.d\ folder in your local machine's Home Directory; e.g.

  • Windows XP: C:\Documents and Settings\{your username}\.vagrant.d\
  • Windows 7: C:\Users\{your username}\.vagrant.d\
    1. Double-click on the insecure_private_key file;
    2. Toward the bottom of the PuTTYgen dialog box, change the value in the Number of bits in a generated key: field to 2048;
    3. Click on the Save private key button.

Run "vagrant ssh-config" and make note of the HostName, User and Port being used.

Then, launch PuTTY and enter the following connection information:

Category Sub-category Field Value
Session Host Name:
Port: 2222
Connection type: SSH
Connection Data Auto-login username: vagrant
Connection/SSH Auth Private key file for authentication: Click on the Browse button and find the .ppk private key you just converted
Session Saved Sessions vagrant (and then click the Save button for the Load, save or delete a stored session area)

Finally, click on the Open button, at the bottom of the PuTTY window, to log in to your Vagrant VM.