Обсуждение: Problem with pg_hba.conf

Поиск
Список
Период
Сортировка

Problem with pg_hba.conf

От
Niral Trivedi
Дата:
All,

I have already posted this message yesterday but didn't get any reply yet...
Please help me with this..I am having trouble doing db authentication with
'pg_hba.conf' file..

I have added two users using 'CREATE USER' command for a db. And then I have
created two separated password file to do authentication to two different db
in the system.

Also, I have added separate lines in 'pg_hba.conf' file for two db as
follows:

local   db1                      crypt    file1.dat
local   db2                      crypt    file2.dat

But problem is I can connect to both db using both password. What I supposed
to get is, I can connect to 'db1' only with username in 'file1.dat' and
'db2' with username in 'file2.dat'. But that is not happening!!!

Can anybody give some suggestions on this??

Thanks in advance..

Niral


RE: Problem with pg_hba.conf

От
Niral Trivedi
Дата:
Tom,

I have that 'local all trust' line commented out. And there is no other
entry in the file at all...

And what do you exactly mean by connecting via IP??? I assume that I am
connecting through UNIX socket because when I commented out the
local    db1    crypt file1.dat
local    db2    crypt file2.dat

and added following line :
host db1    MY_IP_ADDRESS    MASK    crypt file1.dat

It gave me following error:
DBI->connect failed: No pg_hba.conf entry for host localhost, user username,
database db1
 at ./dbTest.pl line 9

Any idea???

TIA

Niral

> Also, I have added separate lines in 'pg_hba.conf' file for two db as
> follows:

> local   db1                      crypt    file1.dat
> local   db2                      crypt    file2.dat

That looks correct as far as it goes.

> But problem is I can connect to both db using both password.

Are you sure the postmaster is checking the password at all?  It sounds
to me like the postmaster might be selecting some earlier entry in
pg_hba.conf and not using these two.  Did you comment out the default
entry for "local all trust"?  Are you perhaps connecting via IP, rather
than via a Unix socket?

            regards, tom lane

Re: Problem with pg_hba.conf

От
Tom Lane
Дата:
Niral Trivedi <niral.trivedi@insage.com> writes:
> Also, I have added separate lines in 'pg_hba.conf' file for two db as
> follows:

> local   db1                      crypt    file1.dat
> local   db2                      crypt    file2.dat

That looks correct as far as it goes.

> But problem is I can connect to both db using both password.

Are you sure the postmaster is checking the password at all?  It sounds
to me like the postmaster might be selecting some earlier entry in
pg_hba.conf and not using these two.  Did you comment out the default
entry for "local all trust"?  Are you perhaps connecting via IP, rather
than via a Unix socket?

            regards, tom lane

Database just stopped working. HELP

От
Steve Heaven
Дата:
One of the databases on our server has simply stopped. All the other dBs on
that server are unaffected.

No psql commands work, not even simple things like \d.
A vaccumdb --verbose produces the output below and then just locks up.
It doesnt seem to be in a loop as its not soaking up CPU power.
This Db has been working fine until now.

Any help would be _gratefully_ appreciated

Steve


NOTICE:  --Relation pg_type--
NOTICE:  Pages 3: Changed 0, Reapped 1, Empty 0, New 0; Tup 148: Vac 0,
Keep/VTL
 0/0, Crash 0, UnUsed 66, MinLen 105, MaxLen 109; Re-using: Free/Avail.
Space 74
56/0; EndEmpty/Avail. Pages 0/0. Elapsed 0/0 sec.
NOTICE:  Index pg_type_typname_index: Pages 8; Tuples 148: Deleted 0.
Elapsed 0/
0 sec.
NOTICE:  Index pg_type_oid_index: Pages 5; Tuples 148: Deleted 0. Elapsed
0/0 se
c.
NOTICE:  --Relation pg_attribute--
NOTICE:  Pages 10: Changed 0, Reapped 1, Empty 0, New 0; Tup 755: Vac 0,
Keep/VT
L 0/0, Crash 0, UnUsed 25, MinLen 97, MaxLen 100; Re-using: Free/Avail.
Space 25
72/0; EndEmpty/Avail. Pages 0/0. Elapsed 0/0 sec.
NOTICE:  Index pg_attribute_attrelid_index: Pages 27; Tuples 755: Deleted
0. Ela
psed 0/0 sec.
NOTICE:  Index pg_attribute_relid_attnum_index: Pages 33; Tuples 755:
Deleted 0.
 Elapsed 0/0 sec.
NOTICE:  Index pg_attribute_relid_attnam_index: Pages 76; Tuples 755:
Deleted 0.
 Elapsed 0/0 sec.
NOTICE:  --Relation pg_proc--
NOTICE:  Pages 21: Changed 0, Reapped 0, Empty 0, New 0; Tup 1021: Vac 0,
Keep/V
TL 0/0, Crash 0, UnUsed 0, MinLen 145, MaxLen 197; Re-using: Free/Avail.
Space 0
/0; EndEmpty/Avail. Pages 0/0. Elapsed 0/0 sec.
NOTICE:  Index pg_proc_prosrc_index: Pages 7; Tuples 1021. Elapsed 0/0 sec.
NOTICE:  Index pg_proc_proname_narg_type_index: Pages 17; Tuples 1021.
Elapsed 0
/0 sec.
NOTICE:  Index pg_proc_oid_index: Pages 5; Tuples 1021. Elapsed 0/0 sec.
--
thorNET  - Internet Consultancy, Services & Training
Phone: 01454 854413
Fax:   01454 854412
http://www.thornet.co.uk