Skip to content

Instantly share code, notes, and snippets.

@encoreshao
Last active February 18, 2022 03:47
Show Gist options
  • Save encoreshao/549a37789d55aa2d7707a96139c0decb to your computer and use it in GitHub Desktop.
Save encoreshao/549a37789d55aa2d7707a96139c0decb to your computer and use it in GitHub Desktop.
Port forward from external PostgreSQL to localhost in backend
❯ vim ~/scripts/startup/simplevpn.sh
#!/bin/bash
/usr/bin/ssh -vfNT -p 8020 -o Compression=yes -o DynamicForward=9090 -o ServerAliveInterval=1 -L 5444:127.0.0.1:5432 username@remote.ip &>/dev/null &
❯ ~/scripts/startup/simplevpn.sh
❯ psql -U pg_user -d db_name -h localhost -p 5444
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment