Tuesday, August 22, 2006

Remote access to a PostgesQL server

A quick note to myself in case I have to do this again, or in case it helps someone else get through the same task more quickly. Gotchas to watch out for when enabling access to a PostgresQL server from another machine:

  • The line in postgres.conf that says listen_addresses = 'localhost' needs to be changed to the actual hostname of the server, because localhost only enables listening on the loopback interface (i.e. the server can listen to connections from clients running locally, but not on any other machines)
  • To allow connection from any host on the same network, add a line to the pg_hba.conf saying: host all all password
    This says: allow access from any (remote) host, where any user (first all) can access any database (second all) if identified by password, and the IP address of the remote host begins 16. - counting the first eight (from the /8) binary digits as significant. The non-matched digits have to be zero, hence the 0.0.0 at the end.

No comments: