We saw that we can
ssh into our vagrant virtual machine in the post Add
SSH Public Key to Vagrant:
$ ssh -i ~/.ssh/id_rsa.pub -p 2222 vagrant@localhost
However it is too long to type, right? And if you ssh into a server you should
remember the IP, like
184.108.40.206. There should be an easy way to do that
since we all are lazy developers (?).
The ssh program on a host receives it’s configuration from either the
cli(as we’ve seen above),
/etc/ssh/ssh_configfile for global-scope,
~/.ssh/configfile for user-scope.
These files are formatted like below:
For our local vagrant machine:
For a remote server:
And then you can access them via
# vagrant virtual machine
$ ssh vagrantlocal
# remove server
$ ssh myremoteserver
You can see more configuration file options at Configuration Options.