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
11-2 presents the options used by the $ vagrant ssh command. You can check
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!).
Listing 11-2. The example contents of /.ssh/config file
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.
If you create the file /.ssh/config shown in Listing 11-2 then the command:
$ ssh localhost
opens the connection to vagrant@127.0.0.1 on port 2222 using private key
from the insecure_private_key file and all the other options from Listing 11-2 .
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:
 
 
Search WWH ::




Custom Search