SSH tunnel to PostgreSQL database behind private network

168 views
Skip to first unread message

Sinae Hong

unread,
Jul 9, 2020, 12:21:08 PM7/9/20
to Sqitch Users
I am currently evaluating the use of Sqitch for our business and I am having some troubles in connecting to a database that is in a private network and would require connecting via an SSH tunnel with a private key. Are there any best practices to connecting to a database in a private network? 

Nikolay Samokhvalov

unread,
Jul 9, 2020, 2:53:49 PM7/9/20
to Sinae Hong, Sqitch Users
(I'm not sure if Sqitch supports this natively.)

A simple way – port forwarding

  ssh -fNTML 9432:localhost:5432 sshus...@your-server.com

And then connect to localhost:9432 when using Sqitch. If your private key is located in some custom file, use the option "-i" as well.

Notice that you should be able to connect to localhost:5432 when sitting on the remote machine using SSH -- editing pg_hba.conf to allow TCP connections to "localhost" may be required.

On Thu, Jul 9, 2020 at 9:21 AM Sinae Hong <sin...@gmail.com> wrote:
I am currently evaluating the use of Sqitch for our business and I am having some troubles in connecting to a database that is in a private network and would require connecting via an SSH tunnel with a private key. Are there any best practices to connecting to a database in a private network? 

--
You received this message because you are subscribed to the Google Groups "Sqitch Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sqitch-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sqitch-users/7e4043b7-9799-4642-a83c-65cc20e60746o%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages