Thread: pg_hba.conf

pg_hba.conf

From
Antonello De Santis
Date:
Hi again,

I need help to set up the config file pg_hba.conf..... The problem is that the
database only accepts connections coming from a local unix socket and not from
a valid tcp/ip address.
My pg_hba.conf file looks like this:

local        all                    trust
host         all         192.168.1.0     255.255.255.0    trust

I have a local network made up of two machines whose addresses are 192.168.1.1
and 192.168.1.2, so I tell to accept every request coming from the local
network. If I comment out the first line, relative to unix socket, and restart
postgresql, when I try to access a database I get an error message "user
authentication failed". Why's that? I think I start the postmaster in the right
way, that is, specifying the -i option:

case "$1" in
  start)
    echo -n "Starting postgresql service: "
    su postgres -c '/usr/bin/postmaster -i -S -D/var/lib/pgsql'
    sleep 1
    pid=`pidof postmaster`
    echo -n "postmaster [$pid]"
    touch /var/lock/subsys/postmaster
    echo
    ;;

Thank you for your help.
Greetings,

  Antonello De Santis


Re: [INTERFACES] pg_hba.conf

From
Bob VonMoss
Date:
Antonello De Santis wrote:

> I need help to set up the config file pg_hba.conf..... The problem is that the
> database only accepts connections coming from a local unix socket and not from
> a valid tcp/ip address.
> My pg_hba.conf file looks like this:
>
> local        all                                        trust
> host         all         192.168.1.0     255.255.255.0    trust

I had the "User Authenication Error" messages trying to manipulate settings in that
file. It didn't work until the admin ran pg_passwd and set a password. No problems
since.

--
Bob VonMoss
mailto:bvonmoss@bigfoot.com
from Chicago, IL



Re: [INTERFACES] pg_hba.conf

From
Tom Lane
Date:
Antonello De Santis <ua01020@flashnet.it> writes:
> My pg_hba.conf file looks like this:
> local        all                    trust
> host         all         192.168.1.0     255.255.255.0    trust

That's OK as far as it goes, and I imagine that connections from your
other machine will work.  But for TCP connections from the same machine
the postmaster is on, you *also* need

host         all         127.0.0.1     255.255.255.255   trust

because local TCP connections usually go via the standard "loopback
address" 127.0.0.1, not via any external IP address your machine may
have.

            regards, tom lane