Skip to content

allow access to postgresql from outside

allow access to postgresql from outside published on No Comments on allow access to postgresql from outside

With this steps you can configure PostgreSQL to accept connections from the LAN on Port 5432.

  1. edit /var/lib/pgsql/data/postgresql.conf
    listen_addresses = '*'
  2. edit /var/lib/pgsql/data/pg_hba.conf add the network you want to allow like: host all all 192.168.190.0/24 md5
    The file looks then like:

    # "local" is for Unix domain socket connections only
    local   all             all                                     trust
    # IPv4 local connections:
    host    all             all             127.0.0.1/32            md5
    host    all             all             192.168.190.0/24        md5
    # IPv6 local connections:
    host    all             all             ::1/128                 md5
    
  3. reload postgresql
    systemctl restart postgresql.service
  4. check connection with pgAdmin or an other tool

Leave a Reply