I cannot connect to the server by “psql -h xx.xx.xx.xx.” I can connect to my
Ubuntu machine from other computers using SSH and I can connect to
PostgreSQL if I SSH first. But I cannot connect directly to PostgreSQL
either through a client machine or if I run “psql -h xx.xx.xx.xx” while
using my Ubuntu machine.

 

Jason L. Amerson

 

 

From: Steve Atkins <st...@blighty.com> 
Sent: Thursday, November 21, 2019 09:49 AM
To: pgsql-general@lists.postgresql.org
Subject: Re: Remote Connection Help

 

 

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

 

Reply via email to