Skip to content

Xammy.NET

  • Sample Page

How to Connect to Remote Database in pgAdmin4 and DBeaver

31/05/2022 by sammy

SSH allows two computers to communicate and encrypts the shared data. It’s a commonly used method for securely accessing remote server terminals and for file transfer.

SSH can also be used to create a secure communication tunnel between computers for forwarding other network connections that are not normally encrypted, a technique called SSH Tunneling (or port forwarding).

Here are some common scenarios in which you will use SSH tunneling or port forwarding:

  • If the port for the remote service you are trying to access is blocked in the firewall.
  • You wish to securely connect to a service that does not inherently use encryption and many others.

For example, if you wish to connect to a remote PostgreSQL database cluster running on port 5432 on Server A, but traffic to that port is only allowed from Server B (to which you have SSH access). You can route traffic through an SSH connection (tunnel) via Server B to access the database cluster.

This guide assumes that you have pgadmin4 and DBeaver database management tools installed on your Linux system, otherwise, check out these guides:

Configure SSH Tunneling in pgadmin4

Open your pgadmin4 application and start by creating a new server connection, go to the Objects tab, then click Create and click Server. In the pop-up window, under the General tab, enter the server name as highlighted in the following screenshot.

Create SSH Tunneling in pgadmin4Create SSH Tunneling in pgadmin4Create SSH Tunneling in pgadmin4

Next, click on the Connection tab to enter the database connection settings. Enter the database server IP address or FQDN (fully qualified domain name). Then set the port, database name, database username, and the user’s password.

You can check Save password to store the password locally so that you are not prompted to enter it every time you attempt to connect to the database.

Add Database Connection SettingsAdd Database Connection SettingsAdd Database Connection Settings

Next, click on the SSH Tunnel tab. Turn on the “Use SSH tunneling” option, enter the Tunnel host, Tunnel port, SSH username. Then select the Authentication type (either password or identity file).

We recommend using public-key authentication so select IDENTITY FILE and select the private key file from your local machine. Then click SAVE as highlighted in the following screenshot.

Add SSH Tunneling DetailsAdd SSH Tunneling DetailsAdd SSH Tunneling Details

If the provided settings and credentials for both the database connection and the SSH tunnel are correct and valid, the tunnel and database connection should be established successfully.

Connected to Remote DatabaseConnected to Remote DatabaseConnected to Remote Database

Configure SSH Tunneling in DBeaver

After launching DBeaver, go to the Databases tab, then click New Database Connection as shown in the following screenshot.

Create SSH Tunneling in DBeaverCreate SSH Tunneling in DBeaverCreate SSH Tunneling in DBeaver

Select your database driver from the list as highlighted in the following screenshot and then click Next.

Choose Database TypeChoose Database TypeChoose Database Type

Now enter the database connection settings, the database host IP or FQDN, database name, database username, and the user’s password as highlighted in the following screenshot. Then click on the SSH tab to enter the tunnel connection settings as explained in the next step.

Database Connection SettingsDatabase Connection SettingsDatabase Connection Settings

Enable SSH by checking the Use SSH Tunnel option. Enter the Tunnel host, Tunnel port, SSH connection username, and select the Authentication method.

As always, we recommend using Public key authentication. Then select or enter the path to your private key. Then click Finish as highlighted in the following screenshot.

Note: If your private key has a passphrase, you need to provide it.

Use SSH Tunneling DetailsUse SSH Tunneling DetailsUse SSH Tunneling Details

If your database connection and SSH tunnel settings are correct and valid, the connection should be successful. Now you can securely work with your remote database.

Remote Database Connection in DBeaverRemote Database Connection in DBeaverRemote Database Connection in DBeaver

For more information, check out the pgadmin4 documentation or DBeaver SSH connection documentation.

If You Appreciate What We Do Here On TecMint, You Should Consider:

TecMint is the fastest growing and most trusted community site for any kind of Linux Articles, Guides and Books on the web. Millions of people visit TecMint! to search or browse the thousands of published articles available FREELY to all.

If you like what you are reading, please consider buying us a coffee ( or 2 ) as a token of appreciation.

Support Us

We are thankful for your never ending support.

Source

Post navigation

Previous Post:

Installation and Review of Bodhi Linux [Lightweight Distro]

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • How to Connect to Remote Database in pgAdmin4 and DBeaver
  • Installation and Review of Bodhi Linux [Lightweight Distro]
  • Zorin OS Lite 16.1 – A Linux Desktop with Windows Feel
  • Zorin OS Core 16.1 – A Linux Distro for Windows & Mac Users
  • Top 8 YUM/DNF ThirdParty Repositories for RHEL-Based Linux

Recent Comments

  1. Gue on Hello world!

    This is a comment from me

  2. Gue on Hello world!

    Another test comment

  3. A WordPress Commenter on Hello world!

    Hi, this is a comment. To get started with moderating, editing, and deleting comments, please visit the Comments screen in…

Archives

  • May 2022
  • April 2022
  • March 2022

Categories

  • Others
©2022 - Xammy.NET