The Vagrant SSH command is convenient, but in a Windows environment, more specialized SSH clients such as XShell or SecureCRT are often required because the default command line terminal is not very useful.
The default image only supports private_key logins. Vagrant/Vagrant can log in to the system from VirtualBox, but will be rejected if it is used to log in to SSH.
Of course you can change the CONFIGURATION of the SSH service while creating the image so that it can be logged in with a password, but it’s actually much easier to use a key.
The vagrant ssh-config command is used first to see the SSH configuration:
$ vagrant ssh-config
Host default
HostName 127.0.0.1
User vagrant
Port 22222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile E:/VirtualBox/.vagrant.d/boxes/davy-VAGRANTSLASH-centos-7-base/0/virtualbox/vagrant_private_key
IdentitiesOnly yes
LogLevel FATAL
Copy the code
IdentityFile is the private key file.
It turns out that the key file for the virtual machine started by the custom box is fixed in the relevant directory under VAGRANT_HOME. Then it is easy to do, directly in SSH client software import the private key file can be done.