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