1

Ubuntu 16.04 LTS

I have followed the guides which all say the same thing; to enable remote connection to a postgres server, update the postgresql.conf file, update the pg_hba.conf file and make sure the port (5432) is open and firewall is not blocking.

When I attempt to connect to my server from the remote machine using the following command, I receive no response (for example, 'Connection refused...'). It hangs as if the firewall has DROP policy, but I checked and the host's firewall is ACCEPT all. Here is the command:

psql -h 45.67.82.123 -U postgres -p 5432 -d mydatabase

I have googled extensively and can't find anyone else who's psql request sits with no response from the host server.

Edit: I should mention I have been connecting locally on the host machine. I should also mention that the data directory on the host machine is in a non-default location. I have my cluster on a mounted drive, in case this could affect the remote connection.

5
  • Can you connect to Postgres locally from the machine? Commented Jan 12, 2018 at 8:15
  • Yes, I have been working normally on the host machine for weeks Commented Jan 12, 2018 at 8:18
  • Connection refused comes from the network layer and specifically means that the port is not open on the network interface that is being tried. Commented Jan 12, 2018 at 11:40
  • thanks but as I said, I see no such message. I have solved it now. Commented Jan 12, 2018 at 11:41
  • I copy-pasted this message from your question Commented Jan 12, 2018 at 11:42

1 Answer 1

2

Solution: It is my first AWS instance and I didn't know they have their own firewall rules on the platform. So I was highly confused by the fact all my policies were ACCEPT on my server. Turns out you are behind AWS firewall and you have to go onto the platform to add/change security groups etc. In the past when I've used Digital Ocean droplets or Linodes, the firewall policy on the vps is all I need to change. AWS threw me another curveball there.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.