A small hack to enable ssh'ing to Vagrant VMs directly from the command-line.
My personal use-case is in system-level tests where
ssh is used as a part of the program.
It's much easier just to have a test-specific hostname (
vagrant), than having to write
special-cased code to do a
vagrant ssh, or having to add a custom host to
for each Vagrant VM.
nc (netcat). It also currently only works when the Vagrant VMs have a standard
vagrant gem install vagrant-proxyssh if you have a packaged installation of Vagrant.
gem install vagrant-proxyssh if you have Vagrant installed directly as a gem.
gem "vagrant-proxyssh" if you bundle Vagrant in a
vagrant proxy-ssh --setup somewhere with an active Vagrant to add the necessary
The setup routine assumes your login environment has the right Ruby-version in its path.
On OS X, your login environment is determined by
~/.MacOSX/environment.plist, and may
not reflect what you have in your
.zshrc, or such.
Specifically, things may not work with Rubies installed with RVM, rbenv, or Homebrew, since none of the usual paths are in the default environment.
After installation and setup, you can
ssh vagrant from your project directory,
and it'll work just like