I have created a username,password & ssh key with root privileges on a remote server (Vagrant) and I am attempting to connect via the usual methods but my password authentication fails. I can successfully ssh into the server using the same credentials.

How can I configure QGIS to connect to PostgreSQL/PostGIS using an ssh key?


2 Answers 2


QGIS does not support SSH tunneling currently, it is supported by the PGAdmin client.

You can edit the servers pg_hba.conf file to accept external connections and make sure your servers port is listening on 5432, may be worth securing the connection on 5432 to your IP.

The other option is making your own SSH tunnel, I don't have any experience on this but there appear to be guides out there relating to QGIS


We usually do port forwarding on localhost in the Vagrantfile via:

    server_machine.vm.network :forwarded_port, guest: 5432, host: 5433, host_ip: ""

Or you can just simply port forward the ssh tunnel during vagrant ssh:

vagrant ssh -- -L 5433:localhost:5432

Then you can connect from QGIS as usual (localhost, port 5433).

Your Answer

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

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