December 27, 2015
After building vagrant machine the command to ssh into the guest machine is pretty simple.
vagarnt ssh
While working with chef I needed to explicitly ssh into the vagrant machine. It took me sometime to figure it out.
The key is command vagrant ssh-config
. The output might look like this.
$ vagrant ssh-config
Host vmachine
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /Users/nsingh/code/vagrant-machine/.vagrant/machines/vmachine/virtualbox/private_key
IdentitiesOnly yes
LogLevel FATAL
ForwardAgent yes
Open ~/.ssh/config
and paste the output at the end of the file and save the
file.
Now I can ssh into vagrant machine using ssh command as shown below.
ssh vmachine
If you are wondering from where the name vmachine
came then this is the name I
had given to
my vagrant machine
.
If this blog was helpful, check out our full blog archive.