Connect to Your Vagrant Virtual Machine with PuTTY

Tom J Nowell edited this page Feb 4, 2018 · 10 revisions


Note: These are old instructions for VVV 1, and will not work in VVV 2+. For the latest documentation see here

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. Run "vagrant ssh-config" in your Project Folder to locate where your Identityfile (public_key) is. Notice: $HOSTNAME $PORT $LOGINNAME
  2. Open the PuTTYgen utility;
  3. Click on the Load button;
  4. open the Identityfile (it doesn't have an extension and that's fine with PuTTYgen)
  5. Toward the bottom of the PuTTYgen dialog box, change the value in the Number of bits in a generated key: field to 2048, RSA is fine
  6. Save the file (use a $NEW name and the .ppk extension).

Then, launch PuTTY and enter the following connection information:

Category Sub-category Field Value
Session Host Name: $HOSTNAME
Port: $PORT
Connection type: SSH
Connection Data Auto-login username: $LOGINNAME
Connection/SSH Auth Private key file for authentication: Click on the Browse button and find the $NEW.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.

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.