11

Even though it might sound related to this question, it isn't, because I'm intreseted in the use of unix sockets instead of TCP/IP ones.

However, I am unable to connect to a remote PostgreSQL database using unix sockets and an ssh tunnel with pgAdmin4. pgAdmin always claims a refused connection by the server and asks for a password, which makes me wonder. When sshing into the server and using psql a connection can be made just flawlessly using the unix socket (/var/run/postgresql). Is there anything special that needs to be set to allow such a setup, or might this even be a bug in pgAdmin itself? I'd appreciate any ideas to solve this problem without having to resort on TCP/IP connections on the remote side.

I also post some screens from my current config:

connection tab

ssh tunnel tab

Colin 't Hart
9,51015 gold badges37 silver badges44 bronze badges
asked Nov 2, 2020 at 13:19

1 Answer 1

10

That should work fine with the correct ssh command.

To forward from a local Unix socket to a remote one runs

ssh -L /tmp/.s.PGSQL.5555:/var/run/postgresql/.s.PGSQL.5432 -N laurenz@dbserver

Then you would use host /tmp and port 5555 to connect.

To forward a local TCP socket to a remote Unix socket, run:

ssh -L 5555:/var/run/postgresql/.s.PGSQL.5432 -N laurenz@dbserver

Then you would use host 127.0.0.1 and port 5555 to connect.

answered Nov 2, 2020 at 13:23
0

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.