Setting up Putty for Rampant Vagrant

SSH keys are sometimes required for steps throughout the project. Make sure that you have created the key, and that it exists on your host at ~/.ssh/id_rsa. On Windows, I highly recommend that Putty is used for ssh-ing into RV instead of using git-bash/ PHP-Storm. Putty offers a one-time pass-phrase login via Pageant that carries over to other machines via agent forwarding.

  1. Convert key to Putty compatible key
    1. Open Puttygen and select the Conversions menu
    2. Import the id_rsa key ~/.ssh/id_rsa
    3. Select the “Save private key” and save the file as ~/.ssh/private.ppk
    4. Copy the Public key shown in the window and save as ~/.ssh/authorized_keys. Do not use the “Save public key button”.
  2. Create Putty connection to the vagrant box
    1. Hostname:
    2. Port: 2222
    3. Under Connection menu in the left pane:
      1. Data->Auto-login username: vagrant
      2. SSH->Auth
        1. Check the box for Allow agent forwarding
        2. Browse and select your private.ppk key file
      3. SSH→X11
        1. Enable X11 Forwarding
        2. Set the X display location to “localhost:0.0”, minus the quotes.
      4. Select Sessions again on the left panel
      5. Name the save session: website.vbox.local
      6. Click Save button
  3. Configure remote box for SSH key access
    1. Append the contents of your host’s ~/.ssh/authorized_keys to the VM’s ~/.ssh/authorized_keys.
    2. Logout of the vagrant box.
  4. Run Pageant on your local machine and load your private.ppk file.
  5. Open Putty and double click on the newly created saved session name (website.vbox.local) under Default Settings.

The server should auto-connect without prompting for a password/ passphrase.

Author: Jeremy Gonyea

A minimalist lifestyle with lots of technology added for good measure.

Leave a Reply

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