vagrant ssh not working in MobaXterm on Windows

后端 未结 5 736
臣服心动
臣服心动 2021-01-13 21:45

I have already found \"SSH to Vagrant box in Windows\" and added the git bin directory to my windows PATH. I verified that it worked by starting CMD and typing ssh

5条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-13 22:34

    Call me crazy but what about doing this:

    • Setup Vagrant Virtualbox VM like normal
    • In MobaXterm, create a "Bash" shell integration with the working directory setup as the directory of the Vagrant directory for the specific VM you are doing this for (aka ... the directory where the Vagrantfile lives for this VM)
    • In the "Advance Shell Settings", use this command (adjust vagrant path to where ever your Vagrant is installed as MobaXterm bash sees it):

    command /drives/c/HashiCorp/Vagrant/bin/vagrant ssh-config > vagrant-ssh-config && ssh -A -F vagrant-ssh-config default

    Vagrant VM needs to be up for MobaXterm Bash entry for the VM to work. I just setup two Bash shell settings for two Vagrant Virtualbox VMs I created and it seems to work just fine.

    Updated: I went a little further since I've figured this out .. at least for me I did :). I added additional CMD shell sessions MobaXterm for each of my Vagrant VM. These additional CMD shell sessions do Vagrant halt, up, and restart (combo of halt and up) commands against the VMs they are specific to. This is what restart looks like:

    vagrant halt
    vagrant up
    set /p value="Press Enter to continue"
    exit

    The Startup Directory for the above session is, again, the directory where the Vagrantfile lives for this VM. Oh, and make sure that "Use Windows PATH" is checked in Terminal Settings.

提交回复
热议问题