Halloween DealsAmazon USHalloween week deals: useful picks before month-endAmazon US: current deals, useful picks and tech finds.Check DealsWindows FixRecommendedWindows errors stealing your time? Find the fix fastScan stability, cleanup and performance issues.Fix NowHalloween DealsAmazon USOctober picks are moving - compare before checkoutAmazon US: current deals, useful picks and tech finds.See Picks×
FREEDOM251

Freedom251 › Blog › database security

How to Connect pgAdmin to PostgreSQL on a Remote VPS

By Freedom251 Team · · 11 min read

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use pgAdmin’s normal server registration for a direct TCP connection, or—usually the safer choice—use its built-in SSH Tunnel tab so PostgreSQL can stay private on the VPS. A successful connection requires more than the pgAdmin form: PostgreSQL must be listening on the right interface, the VPS and provider firewalls must allow the chosen path, and pg_hba.conf must authorize the client, database, and role.

Before opening pgAdmin, collect the VPS hostname or IP address, the configured PostgreSQL port (often 5432), database name, login role, and the authentication details your server uses. Then choose direct TCP or SSH tunneling deliberately rather than treating a timeout as a pgAdmin problem.

As an Amazon Associate I earn from qualifying purchases.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What must be ready before you open pgAdmin

pgAdmin is the client interface. It does not make a PostgreSQL server reachable by itself. The VPS must be running PostgreSQL, and you need a route from your computer to either PostgreSQL or the SSH service on that VPS.

  • VPS identity: a DNS hostname or IP address that your computer can resolve or reach.
  • PostgreSQL endpoint: the actual listening port and the database you intend to use. PostgreSQL installations commonly use port 5432, but an administrator may have changed it.
  • Database role: a PostgreSQL username with a password or another authentication method accepted by the server.
  • Network design: either a direct TCP route to PostgreSQL or an SSH route to the VPS.
  • Server authorization: a matching host rule in pg_hba.conf for the client address, database, role, and authentication method.
  • Firewall permission: rules at the VPS provider and on the VPS itself that match the route you selected.

Confirm these values with the person who manages the VPS. File locations, service names, firewall interfaces, and configuration reload procedures differ between Linux distributions, hosting providers, and PostgreSQL versions, so avoid copying a command intended for a different environment.

#1 Best Overall
Sale
TOZO A1 Wireless Earbuds Bluetooth 5.3 Light Weight in Ear Headphones | IPX5 Waterproof,2 Mics for AI Calls,Immersive Premium Sound Bass Headset with Charging Case,32 EQ via App Black
  • [Ultra-Lightweight Ear Buds Designed for Small Ears] Each earbud weighs only 3.7g and features a compact, ergonomic in-ear design made especially for small ears. Secure, low-profile, and comfortable for workouts, all-day wear or overnight sleeping.The ultra-slim profile sits flush in your ear with no hard edges poking or rubbing, so you can even sleep on your side without discomfort.
  • [Immersive Stereo Sound with TOZO OrigX Technology] TOZO OrigX tuning delivers clear vocals, balanced mids, and natural stereo sound for music, podcasts, and videos.
  • [Long Battery Life for Daily Use] Get up to 7 hours of playtime on a single charge, with up to 32 hours total using the charging case—ideal for workdays, commuting, and extended listening sessions.
  • [Bluetooth 5.3 & Stable Connection] Bluetooth 5.3 provides fast pairing, stable wireless performance, and reduced dropouts as you move around home or office.
  • [Deep Bass with Clear Vocals] High-performance drivers produce punchy bass while keeping vocals clean and detailed for everyday listening.

Choose direct TCP or an SSH tunnel

There are two sound designs. A direct connection sends pgAdmin traffic to PostgreSQL’s network listener. An SSH tunnel sends pgAdmin traffic through an SSH session, allowing PostgreSQL to remain bound to a private interface or loopback address.

Connection design PostgreSQL exposure Firewall work TLS relationship Operational trade-off
Direct TCP The PostgreSQL port is reachable from the client network. The provider firewall, VPS firewall, listener, and pg_hba.conf must all permit the client. SSL/TLS is a separate decision. Enable it when the server requires or your security policy calls for it. Simple once correctly configured, but it creates a publicly reachable database endpoint if the port is exposed to the Internet.
SSH tunnel PostgreSQL can remain private; pgAdmin reaches it through the SSH server. Only the SSH route needs to be reachable from your computer. PostgreSQL need not have a public firewall rule. SSH protects the transport, but it does not automatically satisfy a PostgreSQL SSL requirement. Configure pgAdmin SSL if the database requires TLS. Usually safer for administration, with an SSH account, key or password policy, and tunnel settings to maintain.

When direct TCP is appropriate

Use direct TCP when an application, monitoring system, or controlled administrator network genuinely needs a routable PostgreSQL endpoint. Restrict the provider and VPS firewall rules to the smallest source range possible, and make the PostgreSQL host rules equally narrow. A port open in a firewall is not authorization; PostgreSQL still evaluates pg_hba.conf.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

When an SSH tunnel is preferable

Use the tunnel when PostgreSQL should not be exposed as a public service, when the VPS already accepts SSH from your workstation, or when you want to avoid adding a public database-port rule. pgAdmin’s documentation describes the SSH Tunnel tab as a way to connect through an intermediary host to a server the client cannot reach directly. In this design, the SSH server must run on the database machine (or on a host that can reach it), and PostgreSQL sees the connection at the address where the SSH side binds it.

Prepare PostgreSQL for a direct connection

A fresh PostgreSQL installation may not listen on TCP/IP at all. PostgreSQL’s connection-error guidance explicitly notes that an out-of-the-box server does not listen on TCP/IP ports for security reasons. Consequently, a direct pgAdmin attempt can fail even when the database service is running.

Rank #2
Sale
Smart Watch for Men Women Compatible with iPhone Samsung Android Phone 1.69 inch Full Touch Screen IP68 Waterproof Bluetooh Fitness Tracker Heart Rate/Sleep Monitor (Black)
  • 【IP68 Waterproof Multifunctinal Smart Watch】Torjalph fitness activity tracker smart watch is IP68 waterproof technology ,you can wear it when swimming,handwashing,it's rain-proof which means that you perform multiple exercise modes outside without worrying about sweat or rain corroding your fitness smart watch,and this watch equipped with a 230 mAh large capacity battery magnetic charging ,and this sports activity tracker watch can be used 5-7 days If fully charged.
  • 【Larger 1.83'' Full Screen Watch & Multi-dial Selection】1.83 inch full HD color touch screen smart watch for men / women provides excellent 240*284 resolution image quality ,This Bluetooth smart watch offers a better touch experience and remarkable immersion and ,more than 200 watch faces for you to choose from App"Da Fit ", you can change the dial style according to your mood to wear keeping the world on your wrist
  • 【Accurate Activity Tracker Smart Watch 】sports watch activity tracker uses sweat and dust resistant breathable silicone strap, our Fitness Tracker Smart Watch for Android iOS Phones supports 12 sports modes,walking,running,bicycle,swimming,badminton,basketball,football,rope skipping. This bluetooth calls smart watch for men women is lightweight and stylish, bringing more convenient and relaxing sports experience while also providing more protection.
  • 【Your 24 Hour Personal Daily Health Monitor】Fitness watch for women men full touch screen IP67 waterproof bluetooth smartwatch for Android iOS Phones with heart rate blood pressure monitor multifunction Andriod smart watch with steps counter sleep monitor sports fitness watch, monitoring blood oxygen saturation allows you to understand your physical condition in real time to track fitness progress ,to know your health status in time.
  • 【More Functions Bluetooth Call Smart Watch】This fitness activity smart watch full screen for iPhone and Android phones includes a bunch of new features including:The bluetooth smart watch can hang up the phone, receive and display WhatsAPP /Text /Facebook /Twitter /Messenger reminder.Support sedentary reminder, alarm clock, stopwatch, timer,weather information,music control, remote camera control compatible with Android 5.0 and above or iOS 9.0 and above smartphones.

1. Make the listener reachable

In the PostgreSQL configuration, inspect listen_addresses and the configured port. The listener must include an interface reachable from your client. Binding only to loopback keeps the database local to the VPS and is incompatible with a direct remote connection; it is compatible with an SSH tunnel.

Do not broaden the listener more than necessary. If the server supports a private network interface, prefer that interface over every public interface. After changing the setting, apply the distribution-appropriate PostgreSQL reload or restart procedure and verify that the service is healthy.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

2. Permit the client in pg_hba.conf

pg_hba.conf is PostgreSQL’s host-based access-control file. Add or adjust a host rule that names the required database, role, client address range, and authentication method. Limit the client range to the administrator’s known address or tightly controlled network; avoid broad rules that allow every address or unauthenticated access.

The order of rules matters: PostgreSQL evaluates the first matching rule. A later, more permissive entry cannot repair an earlier match that rejects the connection, and a rule for the wrong database or role will not authorize the login you typed in pgAdmin. Reload PostgreSQL after a rule change using the method supported by your installation.

Rank #3
New Bee Guitar Cable 10ft Electric Instrument Bass AMP Cord
  • [Low Noise High Fidelity] New bee guitar cord with 22AWG oxygen-free-copper center conductors provides enhanced signal transfer, the PVC insulation material and the high-density stranded copper double shield provide noise rejection for quiet operation
  • [Ideal for Choice] New bee 1/4 straight and right angle metal connectors, ensures a secure connection in any instrument, pedal, or amp jack. L shape great fro on stage guitar stands
  • [Wide Compatible] Suitable for mixer, power amplifier, microphone, effector, decoder, equalizer, electoronic organ, electric guitar, electric bass and other electronic equipments. Widely used in the installation of smart home, karaoke speaker, professional stage audio, etc
  • [Easy Disassemble] Making incidental repairs quick and easy! Very nice, flexible cable
  • [Dont Hesite to Order] 24 hours customer services and professional technology team are standing by

3. Align both firewall layers

Permit the PostgreSQL port in the VPS provider’s network controls and in the operating-system firewall, but only from the client range you actually need. Both layers must pass the traffic. Passing one does not override a denial in the other, and allowing the port does not bypass pg_hba.conf.

If your public IP changes, a narrowly scoped rule can stop working without any pgAdmin setting changing. Treat a timeout after an IP change as a possible firewall or host-rule mismatch rather than immediately rotating the database password.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Register the remote server in pgAdmin

The labels can vary slightly by pgAdmin release, but the workflow is consistent.

  1. Open pgAdmin and use the object browser’s server-registration command, commonly Register > Server. Choose a descriptive name such as the environment and purpose; this label is local to pgAdmin and does not change the PostgreSQL server.
  2. Open the Connection tab. Enter the VPS hostname or IP in Host name/address, the configured PostgreSQL port in Port, and the target database in Maintenance database. The maintenance database is the database pgAdmin uses for the initial connection; it must exist and be accessible to the role.
  3. Enter the PostgreSQL login role in Username. Supply its password or select the authentication arrangement used by your installation. Saving a password is convenient on a personal, protected workstation; do not store it in an account that other users can access.
  4. Choose Save or the dialog’s connection test action. A successful registration produces a green status indication in pgAdmin. Expand the server in the browser and confirm that the expected databases and schemas are visible.

For a direct connection, leave the SSH Tunnel option disabled and ensure the host and port point to the PostgreSQL listener. For a tunnel, do not put a public database address in the connection fields merely because it is the VPS address; use the endpoint that the SSH tunnel is configured to forward.

Rank #4
BSIMB 15.6" Digital Family Calendar & Chore Chart, No Subscription Fees
  • Digital Family Calendar: BSIMB digital calendar wall touch screen puts an end to your chaotic life. Designed for busy families, the digital calendar keeps you organised and in step with your family. Assign different colours and tasks to each family member to make family scheduling easier and more intuitive.
  • Easy Setup and Auto-Sync: Plug in, connect to WLAN and auto-syn your electric calendar in minutes. Digital wall calendar compatible with Google calendar, iCloud calendar, Outlook calendar, Cozi calendar and Yahoo calendar. Add events directly on the device or through the ecalendar app. Electronic calendar stays current whether you're at work or traveling—no manual updates needed.
  • All-In-One Home Assistant: Smart calendar builds habits and encourage independence with personalised chores. Display daily meal plan to reduce the daily ‘What's for dinner?’ stress. To-do lists keep track of everything you want. Turning chores into valuable achievements with stars and rewards, making life easier and more enjoyable.
  • Manage Anytime Anywhere: BSIMB electronic calendar for family stay connected with the powerful ecalendar app. Access and manage your digital wall calendar anytime, anywhere with free features like stars & rewards, photo screensaver, chore charts, meals plans, to-do lists etc. Electronic planner paid features like Magic Import tailor advanced tools for users with special needs.
  • Stay in Touch with Loved Ones: Share photos or videos from your phone to electronic wall calendar with app, instantly update your life moment, and keep in touch with your family, especially those who are far away; you can also surprise your smart calendar digital wall by sending him a wish card; it's also great for keeping tech-illiterate elders in touch with the youngsters.

Configure pgAdmin’s SSH tunnel

An SSH tunnel is often the best administrative default because PostgreSQL can remain inaccessible from the public Internet. It still requires a working SSH account and a PostgreSQL endpoint reachable from the SSH server.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

1. Verify SSH independently

Before changing pgAdmin, confirm that an SSH server is running on the VPS and that the intended user can log in with the organization’s approved method. PostgreSQL’s documentation recommends proving this SSH login first; a tunnel cannot work if the underlying SSH session cannot be established.

2. Enable tunneling in the server dialog

  1. Register or edit the pgAdmin server and open the SSH Tunnel tab.
  2. Set Use SSH tunneling to Yes.
  3. Enter the SSH host and SSH port. This is the address and port used for the SSH service, not necessarily the PostgreSQL port.
  4. Enter the SSH username.
  5. Select the SSH authentication method supported by the VPS: an SSH password or an identity file. If you use a key, select the private-key file that matches the public key authorized for that SSH account and protect the file with normal operating-system permissions.
  6. Return to Connection and enter the PostgreSQL host and port as seen from the SSH server. On many single-VPS installations this is a private address or loopback endpoint, but use the value the server administrator has configured.
  7. Save the registration and watch for pgAdmin’s status result. If the SSH login succeeds but PostgreSQL does not, troubleshoot the database endpoint and PostgreSQL authorization separately.

Password or identity-file authentication?

SSH method Credential handling Use when Important check
Password pgAdmin sends the SSH account password when opening the tunnel; storage and reuse depend on your local settings and policy. The VPS permits password authentication and your organization has approved it. Confirm that the SSH service accepts password logins for this account and that the password is not being confused with the PostgreSQL password.
Identity file pgAdmin uses a private key file, normally paired with an authorized public key on the VPS. The server policy requires key-based SSH or you want to avoid transmitting an SSH account password. Confirm the selected key, its passphrase handling, file permissions, and the matching authorized key on the VPS.

Understand the tunnel’s bind address

The database does not see your workstation as a direct network peer in the same way it would with direct TCP. The SSH forwarding endpoint and the SSH server’s bind address determine what PostgreSQL sees. Therefore, the pg_hba.conf rule must authorize the address presented by the tunnel, and the PostgreSQL host field in pgAdmin must refer to a destination reachable from the SSH server.

SSH encryption and PostgreSQL TLS solve different layers. A tunnel protects the SSH transport, but if your PostgreSQL policy requires SSL, configure SSL in pgAdmin as well.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Configure SSL/TLS when the server requires it

In the pgAdmin server dialog, the SSL settings include an SSL mode and fields for a root certificate authority, client certificate, and client key, along with related certificate options. Use the mode specified by the PostgreSQL administrator; choosing a permissive mode simply to silence an error can remove certificate verification.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Certificate checklist

  • Use the correct root CA when the server certificate is signed by a private or organizational authority.
  • Provide a client certificate and private key only when the server’s authentication policy requires mutual TLS.
  • Ensure the certificate’s hostname matches the host value used for verification when verification is enabled.
  • Protect private-key files. pgAdmin Desktop and pgAdmin Server handle certificate storage differently, so review the deployment mode and local file permissions before saving keys.
  • Do not assume that an SSH tunnel eliminates a separate PostgreSQL SSL requirement.

Test the connection in a controlled order

Testing one layer at a time prevents a misleading pgAdmin error from sending you to the wrong configuration file.

  1. Confirm the service: verify that PostgreSQL is running on the VPS and that the configured database and role exist.
  2. Confirm the route: for direct TCP, check that the client can reach the intended host and port through both firewall layers. For SSH, verify the SSH login first.
  3. Confirm the listener: check that listen_addresses and the port match the host and port entered in pgAdmin.
  4. Confirm authorization: compare the client address, database, role, and authentication method with the first matching pg_hba.conf rule.
  5. Confirm credentials: re-enter the PostgreSQL role and password, keeping them distinct from any SSH credentials.
  6. Confirm TLS: if SSL is required, check the mode and every certificate path, then retry.
  7. Retry in pgAdmin: edit the saved registration rather than creating multiple nearly identical server entries, and note the exact error text.

Diagnose common pgAdmin errors

Message or symptom Most likely layer What to inspect
Connection timed out Network path or firewall VPS/provider firewall rules, operating-system firewall, destination address, port, routing, and whether a direct connection was attempted when an SSH tunnel was required.
Connection refused Listener or destination service Whether PostgreSQL is running, whether it listens on the selected interface and port, whether the SSH tunnel forwards to a live endpoint, and whether another service is rejecting the port.
“The server does not listen on TCP/IP” PostgreSQL listener configuration listen_addresses, the configured port, and whether PostgreSQL was reloaded or restarted after the change. A loopback-only listener requires a tunnel rather than direct TCP.
FATAL: no pg_hba.conf entry PostgreSQL host authorization The first matching rule’s database, role, client address, and authentication method. Add the narrow rule required for this connection and reload PostgreSQL.
FATAL: password authentication failed Credentials or authentication policy The PostgreSQL role name, password, selected database, and the authentication method in the matching host rule. Do not change SSH credentials unless the SSH login itself fails.
SSH authentication fails SSH account or key policy SSH host and port, username, password-versus-key selection, private-key path and permissions, key passphrase, and the VPS account’s authorized keys.
SSH connects but pgAdmin still cannot open the database Tunnel destination or PostgreSQL policy The PostgreSQL host as seen from the VPS, forwarding target and port, listener status, and the pg_hba.conf address that PostgreSQL sees from the tunnel.
SSL certificate or verification error TLS configuration SSL mode, CA certificate, client certificate and key, hostname verification, certificate validity, and pgAdmin’s certificate-storage permissions.

Capture the complete error, including whether it names SSH, PostgreSQL, authentication, or SSL. The wording usually identifies which layer rejected the attempt, while a generic timeout supplies no evidence that the password is wrong.

Security hardening after the first successful login

  • Prefer private access: keep PostgreSQL on a private or loopback interface and use SSH tunneling for administrative work when practical.
  • Constrain source ranges: if direct TCP is unavoidable, limit both firewall rules and pg_hba.conf to the required client CIDR rather than all Internet addresses.
  • Constrain identities: name only the database and role that need access. Avoid broad, unauthenticated host rules.
  • Separate secrets: treat the PostgreSQL password, SSH password, SSH private key, and TLS private key as different credentials with different storage controls.
  • Use TLS deliberately: select the server-required SSL mode and install the correct CA or client certificates instead of downgrading verification.
  • Review exposure after changes: a provider firewall rule, a VPS firewall rule, a PostgreSQL listener, and a host rule form one chain. Remove temporary openings when the task is complete.
  • Protect pgAdmin’s local data: saved passwords and certificate paths may be accessible to users who can access the pgAdmin profile or operating-system account.

Maintenance and change management

Record the values that make the registration reproducible: the VPS name, PostgreSQL port, maintenance database, role, whether the connection is direct or tunneled, SSH host and port, authentication method, and SSL mode. When a provider changes the VPS address, update firewall rules and pgAdmin together.

Keep PostgreSQL and pgAdmin versions in mind when following screenshots or menu names. The concepts—listener, host authorization, SSH tunnel, and SSL fields—are stable, but exact labels and certificate-storage behavior can vary between pgAdmin Desktop and Server deployments. Test a saved registration after upgrades rather than assuming an old tunnel or certificate path still applies.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Direct answer: which setup should you use?

For occasional administration of a PostgreSQL instance on one VPS, register the server in pgAdmin with SSH tunneling enabled and keep PostgreSQL private. Use direct TCP only when a controlled network genuinely requires a routable database endpoint, and then align the listener, both firewall layers, and a narrowly scoped pg_hba.conf rule. Add PostgreSQL SSL settings whenever the server policy requires TLS, regardless of whether the network path is direct or carried inside SSH.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

database securitypgAdminPostgreSQLremote databaseSSH tunnelVPS

Leave a Reply

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

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Recommended PC Tool
Recommended PC Tool
PC Slower Than It Used to Be?Free scan - under a minute
Crashes, No Sound, or Screen Glitches?Free driver scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.