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

Posted March 27, 2016 11.7k views
PostgreSQLLinux 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”

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

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