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

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

    There's a lot of answers already, but they all seem overly complicated or solve problems the asker didn't have.

    simply:

    # save the config to a file
    vagrant ssh-config > vagrant-ssh
    
    # run ssh with the file.
    ssh -F vagrant-ssh default
    

提交回复
热议问题