pg_hba.conf settings for postgres

From: Teju Jakkidi vlogs <teja(dot)jakkidi05(at)gmail(dot)com>
To: pgsql-admin <pgsql-admin(at)lists(dot)postgresql(dot)org>
Subject: pg_hba.conf settings for postgres
Date: 2024-02-17 20:33:45
Message-ID: CAKA2XvYj5S4WWRkMAEjuvsfFO-N=vL=fHXJSXBcV+b6fiHc-tQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

Hello Admins,

I have below settings in my pg_hba.conf file:

local all postgres trust
local all all md5
host all all 127.0.0.1/32 trust
host all all 0.0.0.0/0 md5
host all all ::1/128 trust
host all all ::/0 md5

Our expectation is that - when logging as postgres user from local host,
it should not prompt for the password as we have local for postgres set to
trust and loopback is set to trust.
However, when running psql as postgres user from the local host, it is
still asking for the password.

Adding below lines in pg_hba.conf file is working as expected:

host all postgres Local IP/32 trust

Adding an entry for local host IP and making it trust for postgres user is
working as expected and not prompting for password. However, removing this
line is prompting for the postgres password from the local host.

Not sure why there needs to be an entry for IP even when we already have
local for postgres and loopback set to trust.

Any inputs here will be of great help!!

Thanks,
Teja.

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Tom Lane 2024-02-17 20:40:21 Re: pg_hba.conf settings for postgres
Previous Message Laurenz Albe 2024-02-16 12:33:48 Re: Postgres upgrade from 9.6.9 to postgresql 16 version