Обсуждение: about .pgpass

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

about .pgpass

От
kobolds
Дата:
Hi ,

I have question about.pgpass . I have been playing around with postgresql
privileges setting . I created a role user1 (not superuser) for the testing
. today with this role I can login to the database in which I have grant
without need enter password .

I found the culprit is .pgpass after I alter the role password
psql -d db1 -h 192.168.56.200 -U user1
psql: FATAL:  password authentication failed for user "user1"
password retrieved from file "/home/myuser/.pgpass"

I open the file and found the user1 and password listed inside .
my question.
1. when is postgresql write role user1 inside the file. can I disable the
function?
2. on another  machine  that running pgadmin3 (windows) , when I try connect
using role user1 without password it also allow me , is this correct?

here my pg_hba setting

host    all             postgres        0.0.0.0/0               reject
# "local" is for Unix domain socket connections only
local   all             postgres                                peer
# IPv4 local connections:
host    all             all             192.168.56.0/24         md5
host    all             all             127.0.0.1/32            md5
# IPv6 local connections:
host    all             all             ::1/128                 md5



rgds,
ccc



--
View this message in context: http://postgresql.1045698.n5.nabble.com/about-pgpass-tp5749805.html
Sent from the PostgreSQL - novice mailing list archive at Nabble.com.


Re: about .pgpass

От
Bastiaan Olij
Дата:
Heya,

On 27/03/13 11:44 PM, kobolds wrote:
> Hi ,
>
> I have question about.pgpass . I have been playing around with postgresql
> privileges setting . I created a role user1 (not superuser) for the testing
> . today with this role I can login to the database in which I have grant
> without need enter password .

To my knowledge postgres never writes into pgpass. It is only when you
logon with pgAdmin and tick the 'remember passwords' tickbox that the
password gets written into the pgpass file. Did you try and log on with
that user at some point in time using pgAdmin?

Other then that, try adding the switch -w to the psql command:
psql -d db1 -h 192.168.56.200 -U user1 -w

The -w should force psql to not send a password even if one is included
in pgpass.

Cheers,

Bas