SSH to Vagrant box in Windows?
Solution 1:
I use PuTTY to connect to my Vagrant boxes on Windows7.
Make sure you
- convert the
%USERPROFILE%\.vagrant.d\insecure_private_key
to .ppk using PuTTYGen - use the .ppk key in your PuTTY session - configured in Connection > SSH > Auth > Private key file
- use host
127.0.0.1
- use port 2222 instead of 22
- you can set the default username (vagrant) under Connection > SSH > Auth > Private key for authentication
Solution 2:
You must patch some Vagrant code by modifying only one file, ssh.rb
.
All the info is here: https://gist.github.com/2843680
vagrant ssh
will now work also in Windows, just like in Linux.
EDIT: In newer Versions this became unnecessary. You still have to add the path to your ssh.exe
to your PATH
Variable:
Search for ssh.exe on your computer, copy the Path (i.e. C:\Program Files (x86)\Git\bin
), open System Preferences, find the Environment variable Settings, click on the Path Variable, add the path, separating the existing paths using ;
.
Solution 3:
Another option using git binaries:
- Install git: http://git-scm.com/download/win
- Start Menu > cmd (shift+enter to go as Administrator)
set PATH=%PATH%;C:\Program Files\Git\usr\bin
vagrant ssh
Hope this helps :)
Just a bonus after months using that on Windows: use Console instead of the Win terminal, so you can always open a new terminal tab with PATH set (configure it on options)
Solution 4:
Download Putty: http://www.chiark.greenend.org.uk/~sgtatham/putty/
Using putty.exe:
Putty GUI:
HostName: 127.0.0.1
Port: 2222
When you connect(Terminal Screen):
User: vagrant
Passwd: vagrant
Before you try to connect, verify your VM using cmd.exe:
vagrant status
If it is down use:
vagrant up