Allow Remote Postgres Cluster Access
Allow Remote Postgres Cluster Access#
-
Listen on remote ips
sudo vim /etc/postgresql/<version>/main/postgresql.confSet:
listen_addresses = '*'One could limit it to a specific subnet or ip
Your config file can be viewed with
sudo -u postgres psql -c "SHOW config_file;" -
Modify pg_hba.conf
sudo vim /etc/postgresql/<version>/main/pg_hba.confSet:
host all all 0.0.0.0/0 md5 -
Allow port 5432 on the firewall
sudo ufw allow 5432/tcp -
Restart postgres
sudo systemctl restart postgresql
https://blog.devart.com/configure-postgresql-to-allow-remote-connection.html https://stackoverflow.com/questions/18580066/how-to-allow-remote-access-to-postgresql-database https://tecadmin.net/postgresql-allow-remote-connections/