Allow remote machines to connect to Postgres DB

To enable Postgres remote access modify the following file and restart Postgres server

You need to locate the file postgresql.conf with the following command:

find / -name "postgresql.conf"

in this case the file is located in /etc/postgresql/9.2/main/postgresql.conf but this will vary depending on your installation method

Edit the file postgresql.conf, change and uncomment line below:

listen_addresses = '*'

Next you need to add the IP of the machine you want to allow access so locate the file pg_hba.conf:

find / -name "pg_hba.conf"

edit the file and add the ip of the machine you want to be allowed to connect:

host    all             all             1.2.3.4/32            trust

Restart postgres and you will now have access!

Tags:
postgres

v1.9.1

© ScottFreeIT.com 2020