Setting up a SSH tunnel for connecting qgis to postgresql - Greenstand/treetracker-gis GitHub Wiki

Setting up a SSH Tunnel using PuTTY (https://www.putty.org/)

Generating a Key: The key should be in ppk format - convert format using the PuTTYgen - save as private key.

PuTTY:

  1. Session category tab: Specify the destination you want to connect to

        Enter the Host name/ IP address and port number for the Bastion-like server or Bastion  
        
        Connection type: SSH
    
  2. Connection > SSH > Auth category tab: load a new private key file for authentication

  3. Connection > SSH > Tunnels category tab: Add a new forwarded port

        Souce Port (different from the port number in Session - database port number) 
    
        Destination ( database IP address: Source Port)
    
        Select: Local, Auto
    
  4. Go back to the Session category tab: Save session

CMD line: netstat -an to check for active ports check if Source Port number is active