I would like to reproduce the way Vagrant logs in to my VM within a shell script using an ssh
command, so I create an alias to my Vagrant instance.
What
You can add ssh config for your vagrant host to ssh config.
Get ssh config for vagrant machine in vagrant folder: vagrant ssh-config
Open {UserDir}/.ssh/config
and append there result from the previous command. Note: the first line Host default
mean the alias which you will use later for ssh
command. Name it as your vagrant machine or dir. If you have only one vagrant dir - you can name it Host vagrant
Ssh to vagrant: ssh vagrant
. The last name is alias from the previous step.