Skip to content

Instantly share code, notes, and snippets.

@camsaul
Created September 24, 2014 20:16
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save camsaul/b42b3cfbf823e9429c28 to your computer and use it in GitHub Desktop.
Save camsaul/b42b3cfbf823e9429c28 to your computer and use it in GitHub Desktop.
Make a SSH Tunnel to a Postgres DB hosted in Vagrant VM
#! /bin/bash
ssh -L 5555:localhost:5432 vagrant@localhost -p 2222 -i ~/.vagrant.d/insecure_private_key -fNg # local port 5555 <-> Vagrant port 5432
@dltj
Copy link

dltj commented Dec 10, 2015

The location of the key has changed, so the command line is now:

ssh -L 5555:localhost:5432 vagrant@localhost -p 22 -i .vagrant/machines/default/virtualbox/private_key -fNg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment