Thread: pg_hba.conf, md5 and .pgpass

pg_hba.conf, md5 and .pgpass

From
"Mick McElarney"
Date:

Hi,

Here is my pg_hba.conf file configuration:

What should I change so that it reads my /home/postgres/.pgpass file when I execute a psql –Upostgres databasename?

 

 

# TYPE  DATABASE    USER        CIDR-ADDRESS          METHOD

 

# "local" is for Unix domain socket connections only

local   all         all                               md5

# IPv4 local connections:

host    all         all         127.0.0.1/32          md5

host    all         all         111.222.333.0/24        md5

# IPv6 local connections:

host    all         all         ::1/128               md5

 

/home/postgres/.pgpass looks like this:

 

127.0.0.1:*:*:postgres:password

192.168.1.218:*:*:postgres:password

192.168.1.221:*:*:postgres:password

 

I have executed an alter user postgres with encrypted password ‘password’;

 

Thanks, Mick.

Re: pg_hba.conf, md5 and .pgpass

From
Tom Lane
Date:
"Mick McElarney" <Mick.McElarney@maxsp.com> writes:
> What should I change so that it reads my /home/postgres/.pgpass file
> when I execute a psql -Upostgres databasename?

When you're logged in as somebody besides postgres, you mean?  It can't
do that, and it'd be a huge security hole if it could.

You can, however, have it read your *own* .pgpass file for an entry
giving the postgres password.

            regards, tom lane