Skip to content

Instantly share code, notes, and snippets.

@miguelmota
Created July 2, 2022 00:56
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save miguelmota/0e32f87b32ddb4205dedd37f948c6611 to your computer and use it in GitHub Desktop.
Save miguelmota/0e32f87b32ddb4205dedd37f948c6611 to your computer and use it in GitHub Desktop.
PostgreSQL SSH Tunnel Example
Host db_tunnel
HostName 1.2.3.4
User ubuntu
Port 22
RemoteCommand echo 'tunnel open' && cat
IdentityFile ~/.ssh/hop/id_rsa
IdentitiesOnly yes
Localforward 5432 localhost:5432
# terminal 1
ssh db_tunnel
# terminal 2
psql -h localhost -U postgres
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment