Thread: pgAdmin Unable to connect to server via SSH Tunnel (nothing in logs)
Using pgAdmin to connect to postgres via SSH Tunnel is giving me the following error.
Unable to connect to server:
server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
The only thing in the postgres server log is...
2018-09-02 21:56:14.433 UTC [2613] [unknown]@[unknown] LOG: incomplete startup packet
And the pgadmin4.log
2018-09-02 17:19:42,934: INFO pgadmin: Failed to connect to the database server(#2) for connection (DB:postgres) with error message as below:server closed the connection unexpectedly
This probably means the server terminated abnormally
before or while processing the request.
I have no issues connecting via SSH Tunnel using Datagrip, and I'm using the same credentials\settings in pgAdmin ad DG...
I'm at a loss of what to do next to continue troubleshooting, as nothing useful is in the logs.
Ubuntu 18.04 running PGSQL 10 on VirtualBox
pgAdmin 4 (3.2) running on Windows 7
Hi David
Can you please provide the following information:
- Your database server and pgAdmin4 running on same machine?
- Provide screenshot of connection and SSH Tunnel tab of the server dialog.
- Will you be able to connect using SSH command from command prompt with same credentials
On Mon, Sep 3, 2018 at 4:37 AM, David A <dangelsaurus@gmail.com> wrote:
Using pgAdmin to connect to postgres via SSH Tunnel is giving me the following error.Unable to connect to server:server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.The only thing in the postgres server log is...2018-09-02 21:56:14.433 UTC [2613] [unknown]@[unknown] LOG: incomplete startup packetAnd the pgadmin4.log2018-09-02 17:19:42,934: INFO pgadmin: Failed to connect to the database server(#2) for connection (DB:postgres) with error message as below:server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.I have no issues connecting via SSH Tunnel using Datagrip, and I'm using the same credentials\settings in pgAdmin ad DG...I'm at a loss of what to do next to continue troubleshooting, as nothing useful is in the logs.Ubuntu 18.04 running PGSQL 10 on VirtualBoxpgAdmin 4 (3.2) running on Windows 7
Akshay Joshi
Sr. Software Architect

Phone: +91 20-3058-9517
Mobile: +91 976-788-8246
Mobile: +91 976-788-8246
Hi, I'm having the same issue after upgrade from pgAdmin4 version 3.1 to 3.2. I'm running on Centos 7. When I try to connect, after few seconds, it show Connection to the server has been lost error message. -- Sent from: http://www.postgresql-archive.org/PostgreSQL-pgadmin-support-f2191615.html
db server is an Ubuntu 18.04 VM, running on my same machine (Win7) as pgAdmin4, but with an assigned IP address (bridged adapter)
One thing to note, I did verify that pgAdmin would connect if I disabled UFW and didn't use SSH Tunnel.






Yes I have no issues connecting via SSH with Putty. And no issues connecting with DataGrip (screenshots below)


On Wed, Sep 5, 2018 at 12:21 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:
Hi DavidCan you please provide the following information:
- Your database server and pgAdmin4 running on same machine?
- Provide screenshot of connection and SSH Tunnel tab of the server dialog.
- Will you be able to connect using SSH command from command prompt with same credentials
On Mon, Sep 3, 2018 at 4:37 AM, David A <dangelsaurus@gmail.com> wrote:Using pgAdmin to connect to postgres via SSH Tunnel is giving me the following error.Unable to connect to server:server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.The only thing in the postgres server log is...2018-09-02 21:56:14.433 UTC [2613] [unknown]@[unknown] LOG: incomplete startup packetAnd the pgadmin4.log2018-09-02 17:19:42,934: INFO pgadmin: Failed to connect to the database server(#2) for connection (DB:postgres) with error message as below:server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.I have no issues connecting via SSH Tunnel using Datagrip, and I'm using the same credentials\settings in pgAdmin ad DG...I'm at a loss of what to do next to continue troubleshooting, as nothing useful is in the logs.Ubuntu 18.04 running PGSQL 10 on VirtualBoxpgAdmin 4 (3.2) running on Windows 7--Akshay JoshiSr. Software ArchitectPhone: +91 20-3058-9517
Mobile: +91 976-788-8246
Attachment
Hi David
I have tried the same scenario my database server is on Windows 10 Pro (VM) and pgAdmin4 is running from my MAC OSX. In the connection tab I have provided the IP address of Windows machine and in SSH Tunnel tab I have provided the IP Address and credentials of my MAC machine from where I will have to create SSH Tunnel. It works absolutely fine. Attached is the screenshots.
In your scenario you have provided the same IP Address in Connection and SSH Tunnel tab, that need to be change as per my understanding.
Note: I have disabled the firewall on Windows Machine.
On Sat, Sep 22, 2018 at 6:02 AM David A <dangelsaurus@gmail.com> wrote:
db server is an Ubuntu 18.04 VM, running on my same machine (Win7) as pgAdmin4, but with an assigned IP address (bridged adapter)One thing to note, I did verify that pgAdmin would connect if I disabled UFW and didn't use SSH Tunnel.Yes I have no issues connecting via SSH with Putty. And no issues connecting with DataGrip (screenshots below)On Wed, Sep 5, 2018 at 12:21 AM Akshay Joshi <akshay.joshi@enterprisedb.com> wrote:Hi DavidCan you please provide the following information:
- Your database server and pgAdmin4 running on same machine?
- Provide screenshot of connection and SSH Tunnel tab of the server dialog.
- Will you be able to connect using SSH command from command prompt with same credentials
On Mon, Sep 3, 2018 at 4:37 AM, David A <dangelsaurus@gmail.com> wrote:Using pgAdmin to connect to postgres via SSH Tunnel is giving me the following error.Unable to connect to server:server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.The only thing in the postgres server log is...2018-09-02 21:56:14.433 UTC [2613] [unknown]@[unknown] LOG: incomplete startup packetAnd the pgadmin4.log2018-09-02 17:19:42,934: INFO pgadmin: Failed to connect to the database server(#2) for connection (DB:postgres) with error message as below:server closed the connection unexpectedlyThis probably means the server terminated abnormallybefore or while processing the request.I have no issues connecting via SSH Tunnel using Datagrip, and I'm using the same credentials\settings in pgAdmin ad DG...I'm at a loss of what to do next to continue troubleshooting, as nothing useful is in the logs.Ubuntu 18.04 running PGSQL 10 on VirtualBoxpgAdmin 4 (3.2) running on Windows 7--Akshay JoshiSr. Software ArchitectPhone: +91 20-3058-9517
Mobile: +91 976-788-8246
Akshay Joshi
Sr. Software Architect

Phone: +91 20-3058-9517
Mobile: +91 976-788-8246
Mobile: +91 976-788-8246