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

后端 未结 16 1538
清酒与你
清酒与你 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:31

    If you just want to set it up so you can use normal the normal ssh commandline, as well as scp and such, you can run vagrant ssh-config and append the output to your default ssh configuration. If you replace the line "Host default" with a more descriptive hostname, you should be good to go.

    vagrant ssh-config |sed -e "s/Host default/Host my_cool_dev_box/" >> ~/.ssh/config
    ssh my_cool_dev_box
    

提交回复
热议问题