Question on pg_hba.conf - Mailing list pgsql-general

From Niral Trivedi
Subject Question on pg_hba.conf
Date
Msg-id 328DC4EC2C9B74428D8DAED1931285BF10D949@FLAN-EXCH01.corp.insage.com
Whole thread Raw
List pgsql-general
All,

I am a newbie to postgreSQL so forgive me if you find this question a stupid
one...

Question I have today is regarding how to protect a DB with
username/password. I have found that you can put a line in 'pg_hba.conf'
file like following:
local   db_name      crypt   file.dat

where file.dat contains 'username:<crypted password>' pair per line.

But still what I have seen that if you don't add a user with SQL comman
"CREATE USER user WITH password 'password'" you won't be able to use that
username/password for connecting to db_name from your application!!!!

For example, I have username 'user' and password 'pass' in my file.dat and I
have the line as I have typed earlier in my pg_hba.conf and if I try to
connect to db_name I failed.. I have to add 'user' and 'pass' from the SQL
prompt in the pg_shadow file(I assume) and then and then I was able to
connect to db_name.

So, my question is, what is the advantage of having a separate file like
'file.dat' and crypt in pg_hba.conf file??? And strange thing I found is, I
can connect to the database with the username which is not in my
'file.dat'!!!!

I am sure I am missing something.. but all comments and advices are
welcome..

Thanks in advance..

Niral


pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: Creating index with UPPER
Next
From: The Hermit Hacker
Date:
Subject: Public News Server access ...