I’m using PostgreSQL 8.1. It’s currently set up to accept connections for the users: dbuser and postgres on localhost (127.0.0.1). How can I accept communication to certain databases or users over different IP addresses?
the ‘listen_addresses’ option in postgresql.conf determines which addresses the database server will respond to. It takes the form of a comma separated list. The following will listen on the localhost address and 192.168.1.25:
listen_addresses = '192.168.1.25, localhost'
The pg_hba.conf file defines which users can connect to which databases over which addresses. The following example will allow everyone to connect to any database over localhost, and postgres to connect to the sample database over 192.168.1.25
# TYPE DATABASE USER CIDR-ADDRESS METHOD
host all all 127.0.0.1/32 md5
host sample postgres 192.168.1.25/24 md5
Be sure to restart the service for changes to take effect.