0

I have the following situation:

  • My VPS can access PostgreSQL on another machine
  • My Linux laptop can't access the same PostgreSQL server for authentication reasons that shouldn't matter (I can't change anything about the setup)
  • My laptop has full access to the VPS

Let's say the PostgreSQL host is pg.some.domain. Can I somehow use the VPS as a proxy so that I can connect to pg.some.domain from my laptop? I vaguely remember doing this using some easy-to-use CLI tool but now I can't find it after a lengthy Google session.

1
  • Never heard about a VPS, but maybe an SSL tunnel is what you need. Commented Jan 27, 2020 at 11:49

1 Answer 1

2

Looks like you need port forwarding here. Open an ssh connection from your laptop to the VPS and setup an ssh tunnel forwarding local port 5432 to pg.some.domain:5432 (I'm assuming postgres is running on standard port)

ssh -L 127.0.0.1:5432:pg.some.domain:5432 [your VPS IP here]

Now you should be able to access the PG server from your laptop by connecting to 127.0.0.1:5432

HTH

Sign up to request clarification or add additional context in comments.

1 Comment

Good solution, though I ended up using the TCP proxy balance on the server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.