Re: Remote Connection Help - Mailing list pgsql-general

From Steve Atkins
Subject Re: Remote Connection Help
Date
Msg-id f137d7cc-0c7d-9019-839f-f58b376ab90d@blighty.com
Whole thread Raw
In response to Re: Remote Connection Help  (Ekaterina Amez <ekaterina.amez@zunibal.com>)
Responses RE: Remote Connection Help  ("Jason L. Amerson" <drjason@alphagenius.org>)
List pgsql-general


On 21/11/2019 14:30, Ekaterina Amez wrote:
El 21/11/19 a las 15:21, Jason L. Amerson escribió:

I am at a loss for what to do. I have read article after article about how to allow remote connections on my PostgreSQL server and none of what the articles say do, worked for me. I have edited the “postgresql.conf” file and changed “listen_address = ‘localhost’ to listen_address = ‘*’.

I think that's "listen_addresses" on recent versions of postgresql.

Did you stop and restart the service after you edited the config file? Check the logs for errors too, maybe.


I have even tried it commented out and uncommented and I get the same results. I also edited the “pg_hba.conf” file and added the following at the end of the file:

 

host all all 0.0.0.0/0 md5

host all all ::/0 md5

The first line in pg_hba.conf that matches a connection will take effect; later lines won't.


For testing connection purposes I'm used to change md5 to trust, this way you won't have troubles with passwords nor users.

Don't do this on a machine that's reachable from the open internet, ever. It's asking to get your box compromised.

 

My computer that is running the server is Ubuntu and it has a static IP. I am trying to connect remotely with computers running Windows 10 using the static IP. When I run pgAdmin from my Windows 10 machine, or use the command line to connect, I get the following error:

 

unable to connect to server:

 

could not connect to server: Connection refused (Ox0000274D/10061) Is the server running on host " xx.xx.xx.xx" and accepting

TCP/IP connections on port 5432'

 

I would like to be able to connect to my Ubuntu PostgreSQL server from all Windows 10 machines as well as from a client on my Android phone while away from home. That is my goal now. I am hoping that someone can help me to get this working. This is been very frustrating.

 

Can you connect to your server on it's external address at all? i.e. if it's external IP address is 10.11.12.13, can you run "psql -h 10.11.12.13" on your ubuntu box and connect / log in?

If you can then postgresql is configured correctly and you can focus on where the issue on the network is.

If not, then the problem is the local machine, either postgresql configuration or _maybe_ local network configuration silliness.

Cheers,
  Steve


Attachment

pgsql-general by date:

Previous
From: Sébastien Bihorel
Date:
Subject: Tablespace setup issue
Next
From: Laurenz Albe
Date:
Subject: Re: Isolation of multiple databse instances provided by a singlepostgres server