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.
ssh
What
I solved this in a very simple way: when you start the vagrant box it shows the ssh address like this
SSH address: 127.0.0.1:2222
then you can connect to the box by using the vagrant user, the host and the port you get
ssh vagrant@127.0.0.1 -p 2222