Creating SSH Connection

SSH (Secure Shell Host) connection is established between an SSH server and a client (it is built in dbForge Studio). The client is used to access remote machines and execute commands.

SSH protocol offers SSH tunneling to provide secure transmit of data. All the data transmitted over the insecure network is encrypted on one side of SSH connection and decrypted on another side. This ensures privacy, authenticity, and integrity of transmitted data and allows you to connect to a remote PostgreSQL Server, when a port is blocked.

SSH connection includes the following stages:

  1. Connection between the SSH Server and the PostgreSQL Server is created.
  2. Authentication between the SSH Server and the PostgreSQL Server is successfully done. The SSH Server can use two types of authentication:
    • Password authentication - it uses a password of a user account on the SSH Server.
    • Public key authentication - it uses a pair of public and private keys which you can generate by a key generator tool, for example, PuTTygen.
  3. The client and PostgreSQL Server exchange the data which is transmitted through the SSH Server.

SSH Connection using Password authentication:

  1. Check that you have the SSH Server installed and set up.
  2. Open the Database Connection Properties dialog box by any of these ways:
    • On the Database menu, select New Connection.
    • Click the New Connection button on the Database Explorer toolbar.
    • Right-click the Database Explorer window and select New Connection on the shortcut menu.
  3. Switch to the Security tab and select Use SSH protocol.
  4. Select Password authentication and input login information required to connect to the SSH server:
    • Host - the name or ip address of the SSH Server.
    • Port - the TCP/IP port to connect to the SSH Server. By default, it is 22.
    • User - the name of the user account on the SSH Server.
    • Password - the password of a user account on the SSH Server.

    Tip: Select the Save password check box, otherwise while opening the connection, the Connect to PostgreSQL Database dialog box will appear and dbForge Studio will ask you to enter the password again.

  5. On the General tab, set login information required to connect to the PostgreSQL Server. It should be set relatively to the SSH Server. Specify the following:
    • Host - the name of the PostgreSQL Server host. If SSH and PostgreSQL Servers are on the same machine, the host name can be localhost. It is highly recommended to specify the IP address explicitly (especially for the Linux OS).
    • Port - the TCP/IP port to connect to the PostgreSQL Server.
    • User - the name of the user account on the PostgreSQL Server.
    • Password - the password of the user account on the PostgreSQL Server.

  6. Specify the default database of the PostgreSQL Server. To see all databases of the selected PostgreSQL Server in the Database Explorer window, select Show all databases, otherwise you will see only the selected one.
  7. (Optional) To test the created connection, click the Test Connection button.
  8. Click OK to establish the database connection.

SSH Connection using Public key authentication:

  1. Check that you have the SSH Server installed and set up to allow public key authentication. If no, see Installing and Setting Up SSH Server.
  2. Open the Database Connection Properties dialog box by any of these ways:
    • On the Database menu, select New Connection
    • Click the New Connection button on the Database Explorer toolbar
    • Right-click in the Database Explorer window and select New Connection on the menu.
  3. Switch to the Security tab and select Use SSH protocol.
  4. Select Public key authentication and input login information required to connect to the SSH Server:
    • Host - the name or ip address of the SSH Server.
    • Port - the TCP/IP port to connect to the SSH Server. By default, it is 22.
    • User - the name of the user account on the SSH Server.
    • Passphrase - the passphrase for a private key. You can set it while generating public and private keys through a key generator tool, for example PuTTygen.
    • Private key - the private key file location on your local machine. Click the button in the field to specify the location or enter it manually. (You can generate the private key along with a public key using a key generator tool. Note if you are using PuTTygen, you can either convert a generated private key into OpenSSH format (by selecting Conversions>Export OpenSSH key in the menu) or use it without conversion. dbForge Studio supports both formats.

  5. On the General tab set login information required to connect to the PostgreSQL server. It should be set relatively to the SSH server. Specify the following:
    • Host - the host name of the PostgreSQL Server. If SSH and PostgreSQL Servers are on the same machine, the host name can be localhost.
    • Port - the TCP/IP port to connect to the PostgreSQL Server.
    • User - the user of the PostgreSQL Server.
    • Password - the password of the user account on the PostgreSQL Server.

  6. Specify the default database of the PostgreSQL Server. To see all databases of the selected PostgreSQL Server in the Database Explorer window, select Show all databases, otherwise you will see only the selected one.
  7. (Optional) To test the created connection, click the Test Connection button.
  8. Click OK to establish the database connection.

Tip: You can change the default name for the created connection that for a more appropriate one. By default, it has the following format: selected database.PostgreSQL Server host.