How to ssh to vagrant without actually running “vagrant ssh”?

后端 未结 16 1542
清酒与你
清酒与你 2020-11-29 15:07

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

16条回答
  •  攒了一身酷
    2020-11-29 15:34

    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
    

提交回复
热议问题