Information Technology Reference
In-Depth Information
If the file
∼
/.ssh/config
exists then its contents override the options used by
your ssh clients. The most often used options are shown in
Listing 11-2
.
In fact,
Listing
them with the
$ vagrant ssh-config
command. That's why you can connect to
the virtual machine with only minimal effort (without typing port number or pass-
word!).
Host localhost
HostName 127.0.0.1
User vagrant
Port 2222
UserKnownHostsFile /dev/null
StrictHostKeyChecking no
PasswordAuthentication no
IdentityFile /somewhere/.vagrant.d/insecure_private_key
IdentitiesOnly yes
LogLevel FATAL
Hint
To create the file shown in
Listing 11-2
you can use the
$ vagrant ssh-
config >
∼
/.ssh/config
command. If you do this, remember to adjust the set-
tings.
$ ssh localhost
opens the connection to
vagrant@127.0.0.1
on port 2222 using private key
The
vagrant
account on the virtual machine has its
∼
/.ssh/authorized_keys
file with the public key for
insecure_private_key
. That is why you can log
onto the virtual machine with ssh without giving the password!
With these settings the command: