I installed the latest pgAdmin 4 (v2.1) but I found out that (related thread), for the moment, the only way to establish a connection through an SSH tunneling is using another outside process, an example in the pgAdmin's forum says:

I setup a tunnel as follows:

ssh -f dpage(at)hostname(dot)enterprisedb(dot)com -L 5999: hostname.enterprisedb.com:5432 -N

(...) I was running on Mac, but the same procedure should work on Linux. On Windows, there's a tunnelling app in Putty iirc, but I don't know how to use it offhand.

I have found a simple PuTTY tutorial to establish a connection using an SSH Tunnel.

The connection is established but it seems, when I try to connect through pgAdmin it fails or is refused (using or as the tunnel's destination). Why?


So in this step of that PuTTY SSH tunnel tutorial:

Add tunnel in PuTTY

I used instead 5432 as the Source port and my.tunnel.domain:5432 as the Destination.

Then in the connection details:

PuTTY connection details

In the Host Name I placed the server to connect to (the one with the DB: my.db.domain), but the login credentials relate to the tunnel's my.tunnel.domain (e.g. Connection > Data has the tunnel's domain user and Connection > SSH > Auth has the tunnel's domain private key).

I opened this connection (it opens up a window with a terminal, if successful) and finally in the pgAdmin 4 (v2.1) Create Server... window, I just added localhost as the Host name/address and 5432 as the Port, with the credentials relating to the my.db.domain:

pgAdmin SSH Tunnel localhost connection

The DB connection is established and works normally if the PuTTY window with the terminal is active.

Another and more verbose tutorial on how to set a Putty SSH tunnel can be found here.


In newer version of PGAdmin4 you can configure SSH-tunnel (there is a tab for this there, but you need to use key in PEM format, not in RFC4716 that is now generated by default with ssh-keygen.


ssh-keygen -m PEM -t rsa -b 4096

More information here

  • I'm accessing my AWS RDS database via a tunnel through an EC2 instance and this is what got pgAdmin working for me. Set the PEM file in SSH Tunnel > Identity file and it will work. Details on how to convert the PPK file to PEM here. aws.amazon.com/premiumsupport/knowledge-center/… – Greg Robson Jul 2 '19 at 8:08
  • this solved the problem for me as well but, for some reason ssh configurations wont save and now it prompts for a password for the PEM file which is odd. If only mysql workbench had a postgres version. – Michael Sorensen Aug 14 '19 at 20:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.