Even though Vagrant allows for a vast amount of configuration through its commands and the Vagrantfile, nothing beats the power of the command line. Sometimes you just have to get into the files and play around to get things working just right or to debug an application.
Vagrant provides full SSH access to the virtual environments it creates through a single command:
vagrant ssh. By running
vagrant ssh, Vagrant will automatically drop you into a fully functional terminal shell (it really is just
ssh being run, there is no middle man involved in communicating from the VM to the host machine).
vagrant ssh, you should see something similar to the following:
$ vagrant ssh ... vagrant@vagrantup:~$
An SSH client is generally not distributed with Windows by default. Because of this, if you are on Windows, Vagrant will instead output SSH authentication info which you can use with your favorite SSH client, such as PuTTY.
PuTTY may not recognize the
insecure_private_key provided by
vagrant as a valid private key. To remedy this, first grab the
Then use PuTTYgen and import the
in the .vagrant.d dir in your home directory) and save a ppk file from that
private key. Use the ppk file instead of the default one when SSHing into
your vagrant box.
Vagrant bridges your application with the virtual environment by using a VirtualBox shared folder. The shared folder location on the virtual machine defaults to
/vagrant, but can be changed. This can be verified by listing the files within that folder in the SSH session:
vagrant@vagrantbase:~$ ls /vagrant index.html Vagrantfile
The VM has both read and write access to the shared folder.
Remember: Any changes are mirrored across both systems.