Thread: Can't get pg_hba.conf to work

Can't get pg_hba.conf to work

From
Doug Silver
Date:
Can someone please point out the folly of my ways?

Here's my setup, FBSD 4.6, postgresql-7.2.1_1 with the pgsql user as
follows:

Login: pgsql                      Name: PostgreSQL Daemon
Directory: /var/db/pgsql                Shell: /bin/sh


#    ll /var/db/pgsql/data/
total 26
drwx------   6 pgsql  pgsql    512 Jun 26 11:13 ./
drwxr-x---   6 pgsql  pgsql    512 Jun 26 11:06 ../
-rw-------   1 pgsql  pgsql      4 Jun  2 12:42 PG_VERSION
drwx------  12 pgsql  pgsql    512 Jun  8 15:39 base/
drwx------   2 pgsql  pgsql    512 Jun 26 11:16 global/
drwx------   2 pgsql  pgsql    512 Jun  2 12:42 pg_clog/
-rw-------   1 pgsql  pgsql  10879 Jun 26 10:58 pg_hba.conf
-rw-------   1 pgsql  pgsql   1250 Jun  2 12:42 pg_ident.conf
drwx------   2 pgsql  pgsql    512 Jun 25 16:00 pg_xlog/
-rw-------   1 pgsql  pgsql   3865 Jun  5 17:40 postgresql.conf
-rw-------   1 pgsql  pgsql     31 Jun  5 17:30 postmaster.opts
-rw-------   1 pgsql  pgsql     45 Jun  5 17:30 postmaster.pid

And no matter what I put in the pg_hba.conf file, I get the following:
parse_hba: invalid syntax in pg_hba.conf file at line 253, token
"localhost"
FATAL 1:  Missing or erroneous pg_hba.conf file, see postmaster log for
details

Line 253 is commented out, there is no 'localhost' in the file.  I can
connect locally, but I need to setup client access.

Here's the lines I need to work:
# TYPE     DATABASE    IP_ADDRESS    MASK               AUTH_TYPE  AUTH_ARGUMENT
local       all                                            trust
host        all         127.0.0.1      255.255.255.255     trust
host        all         63.212.175.55  255.255.255.255     crypt
host        test        63.212.175.99  255.255.255.255     crypt
host        all         0.0.0.0        0.0.0.0             reject


TIA!

--
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Silver
Network Manager
Urchin Software Corp.    http://www.urchin.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~




Re: Can't get pg_hba.conf to work

From
Tom Lane
Date:
Doug Silver <dsilver@urchin.com> writes:
> And no matter what I put in the pg_hba.conf file, I get the following:
> parse_hba: invalid syntax in pg_hba.conf file at line 253, token
> "localhost"
> FATAL 1:  Missing or erroneous pg_hba.conf file, see postmaster log for
> details

In 7.2 you must SIGHUP the postmaster to get it to take notice of
changes in its config files --- the thing is still complaining about
an error in whatever the file contained when you started it.

"pg_ctl reload" is a convenient script for sending SIGHUP to the
postmaster.

            regards, tom lane



Re: Can't get pg_hba.conf to work

From
Doug Silver
Date:
On Wed, 26 Jun 2002, Tom Lane wrote:

> Doug Silver <dsilver@urchin.com> writes:
> > And no matter what I put in the pg_hba.conf file, I get the following:
> > parse_hba: invalid syntax in pg_hba.conf file at line 253, token
> > "localhost"
> > FATAL 1:  Missing or erroneous pg_hba.conf file, see postmaster log for
> > details
>
> In 7.2 you must SIGHUP the postmaster to get it to take notice of
> changes in its config files --- the thing is still complaining about
> an error in whatever the file contained when you started it.
>
> "pg_ctl reload" is a convenient script for sending SIGHUP to the
> postmaster.
>
>             regards, tom lane
>

Thanks Tom -- That was indeed the problem.

Didn't know about the SIGHUP aspect of postgres.  Hmmm, RTFM? ;-)

I've since added the reload to the contributed startup script so I
remember it the next time.  Nothing more than these four lines:

    reload)
    su -l $PGUSER -c "$DAEMON reload"
    echo 'Reloading (SIGHUP) Postgresql'
    ;;

Thanks.

-d

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Doug Silver
Network Manager
Urchin Software Corp.    http://www.urchin.com
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~