Thread: can't authenticate pg admin

can't authenticate pg admin

From
"Martin J. Brown, Jr."
Date:
I've had this problem with 7.3.3, and now with 7.4.3. ...

The pg admin is the default 'postgres'.  As 'postgres', I do...

postgres@localhost postgres $ 'psql -d template1'
Welcome to psql 7.4.3, the PostgreSQL interactive terminal.

template1=# alter user postgres password 'xyz'
template1=#

I exit 'psql'.

I then edit 'pg_hba.conf', changing from 'trust' to 'password'.
I stop, then start pg.

I then do 'psql -d template1', which results in a password prompt.
I enter 'xyz', and get an authentication error for user "postgres".

Other db users authenticate fine, only the admin fails.

Any ideas on how to fix this?

--
                            - Martin J. Brown, Jr. -
                              - mjbjr@mjbjr.com -
Public PGP Key ID: 0x76A1778E keyserver: http://pgpkeys.mit.edu:11371/
Fingerprint: F2D2 5D2B 333F 79D0 D126  0941 21D6 7321 76A1 778E


Re: can't authenticate pg admin

From
Tom Lane
Date:
"Martin J. Brown, Jr." <mjbjr@mjbjr.com> writes:
> Other db users authenticate fine, only the admin fails.

That seems very odd.  The only theory that comes to mind is that you've
set a password expiration time for that account in pg_shadow.

            regards, tom lane

Re: can't authenticate pg admin

From
"Martin J. Brown, Jr."
Date:
On Fri, 13 Aug 2004 14:54:36 -0400, Tom Lane wrote:

> "Martin J. Brown, Jr." <mjbjr@mjbjr.com> writes:
>> Other db users authenticate fine, only the admin fails.
>
> That seems very odd.  The only theory that comes to mind is that you've
> set a password expiration time for that account in pg_shadow.
>

After double checking...

Yes, the pg admin, "postgres", fails authentication, and regular db users
don't even get asked to authenticate!!

'pg_hba.conf' shows:

local   all         all                                             password

# IPv4-style local connections:
host    all         all         127.0.0.1         255.255.255.255   password

# IPv6-style local connections:
host    all         all         ::1
ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff        password


As for 'pg_shadow', never touched it.

In the process of trying to hunt down this problem, I've set "postgres"'s
pw numerous times.  And the time from that to testing would've been less
than 30 seconds.  A very short expiration, indeed.

Is there a way to check that the pw has actually been set (to anything)?
When I use 'alter user postgres with password 'abc'' within 'psql'and hit
enter, I get a new psql prompt, but no indication of whether the command
succeeded or failed.  Is that normal?

From what I've read, 'pg_users' is a default view (doesn't need to be
created ?) on 'pg_shadow'.  My newbie attempts to view this 'view' have
been unsuccessful.  How do you view/use 'pg_users'?

Thank you.

--
                            - Martin J. Brown, Jr. -
                              - mjbjr@mjbjr.com -
Public PGP Key ID: 0x76A1778E keyserver: http://pgpkeys.mit.edu:11371/
Fingerprint: F2D2 5D2B 333F 79D0 D126  0941 21D6 7321 76A1 778E