Can't connect to remote Postgres DB Using PGAdmin III via SSH Tunnelling

March 27, 2016 7.8k views
PostgreSQL Linux Commands

I am trying to connect remotely to a PostgreSQL DB using PGAdmin III

FYI I am using SSH Keys to connect to my instance, no passwords.

I have setup the SSH tunnel like so:

ssh -L

Then in the postgresql.conf I have modified the listening addresses to: listen_addresses='*'

Just in case, I also added to pg_hba.conf the line :
host all all md5 however I still get the same error so I believe this is useless.

Finally in PGAdmin, I create new connection using
host: localhost
port: 3333 (as per local tunnel option above)
username: myuser
Then on SSH tunnel tab, I have a checkmark on use SSH tunneling
tunnel host:
tunnel post: 5432
username: myuser
identityfile: I point to my local file
and I enter my passphrase.

I get the following error:
SSH error: Error when starting up SSH session with error code -13

I added the -v option to the SSH tunnel creation line and I see “authentication successful” as well as “local forwarding listening on port 3333”

1 Answer

You need to point to your local idrsa file (the private key file).

Have another answer? Share your knowledge.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!