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
, and got a usage message. (Before adding the git bin directory to my path, CMD complained that ssh
wasn't a valid command.)
However...when I run vagrant ssh
from MobaXterm, I get the same error I did before. (A page full of ruby errors that aren't helpful to me.) When I run it as VAGRANT_LOG=debug vagrant ssh
, I see:
INFO subprocess: Starting process: ["C:\\Users\\(myname)\\DOCUME~1\\MOBAXT~1\\slash\\bin/ssh.EXE"]
This is the wrong ssh executable; it's the one installed in MobaXterm and it doesn't work if run from a CMD window.
How can I get vagrant ssh
to work as it should?
Part of the trick is that I don't want to use the Windows PATH for arbitrary commands—not even for ssh, really. I want to use the versions in MobaXterm for everything. All I want is to be able to run vagrant ssh
the same way I would on Linux or Mac.
The workaround I have been using, which I found somewhere online (but can't find the page again), is:
vagrant ssh-config > vagrant-ssh
ssh -F vagrant-ssh default # Works exactly the way `vagrant ssh` should
"default" is the box name for a typical Vagrant environment with only a single vagrant box. If there is more than one box, replace "default" with the box name:
ssh -F vagrant-ssh host001 # Works the way `vagrant ssh host001` would on another system
This is a good workaround with minimal changes required to workflow. But I'd still like a way to get vagrant ssh
working without needing the extra file in my vagrant directory.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With