Thread: Does the initial postgres user have a password?

Does the initial postgres user have a password?

From
"dandl"
Date:

I have a new 9.5 installation, Windows x64, developer only. No users have been added, and no passwords set.

 

I can access the system:

·         using pgAdmin3, without specifying a user or password

·         using psql, specifying user ‘postgres’ but no password

 

I cannot access the system with various other tools that require a connection string eg

password authentication failed for user "postgres"

 

There is a ‘postgres’ user defined in pg_shadow with password of : "md5a19959576d12fc69375fc3dadaeab90b"

 

What is going on here? Is there a password for user ‘postgres’ or isn’t there? What is it? Why don’t I need it sometimes, and I do other times?

 

Regards

David M Bennett FACS


Andl - A New Database Language - andl.org

 

Re: Does the initial postgres user have a password?

From
Albe Laurenz
Date:
dandl wrote:
> I have a new 9.5 installation, Windows x64, developer only. No users have been added, and no passwords
> set.
> 
> I can access the system:
> ·         using pgAdmin3, without specifying a user or password
> ·         using psql, specifying user ‘postgres’ but no password
> 
> I cannot access the system with various other tools that require a connection string eg
> password authentication failed for user "postgres"
> 
> There is a ‘postgres’ user defined in pg_shadow with password of :
> "md5a19959576d12fc69375fc3dadaeab90b"
> 
> What is going on here? Is there a password for user ‘postgres’ or isn’t there? What is it? Why don’t I
> need it sometimes, and I do other times?

You have a password set, and it is probably in a password file, which
might have been created by pgAdmin III.

See http://www.postgresql.org/docs/current/static/libpq-pgpass.html

Yours,
Laurenz Albe

Re: Does the initial postgres user have a password?

From
uğur Karabin
Date:
Other tools may try to connect with different users  or with same users but using ip (not local host) and pg_hba.conf file may not allow paswordless login except localhost.Reseting postgres password with alter user, and configuring  pg_hba.conf file can solve your problem.

Regards,
Ugur

2016-05-03 15:03 GMT+03:00 Albe Laurenz <laurenz.albe@wien.gv.at>:
dandl wrote:
> I have a new 9.5 installation, Windows x64, developer only. No users have been added, and no passwords
> set.
>
> I can access the system:
> ·         using pgAdmin3, without specifying a user or password
> ·         using psql, specifying user ‘postgres’ but no password
>
> I cannot access the system with various other tools that require a connection string eg
> password authentication failed for user "postgres"
>
> There is a ‘postgres’ user defined in pg_shadow with password of :
> "md5a19959576d12fc69375fc3dadaeab90b"
>
> What is going on here? Is there a password for user ‘postgres’ or isn’t there? What is it? Why don’t I
> need it sometimes, and I do other times?

You have a password set, and it is probably in a password file, which
might have been created by pgAdmin III.

See http://www.postgresql.org/docs/current/static/libpq-pgpass.html

Yours,
Laurenz Albe

--
Sent via pgsql-general mailing list (pgsql-general@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-general

Re: Does the initial postgres user have a password?

From
"dandl"
Date:
> From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-
> owner@postgresql.org] On Behalf Of Albe Laurenz

> > What is going on here? Is there a password for user ‘postgres’ or
> > isn’t there? What is it? Why don’t I need it sometimes, and I do other
> times?
>
> You have a password set, and it is probably in a password file, which might
> have been created by pgAdmin III.

Half right.

> See http://www.postgresql.org/docs/current/static/libpq-pgpass.html

Mostly right. Thanks -- another part of the docs I've never found before.

Turns out that the superuser account does indeed have a password (how else would I have got past that annoying prompt
duringinstallation?) and the installer created a file in one of the strange Windows user data folders (not exactly the
onelisted in the docs, but close). Both pgadmin and psql know how to find that file, but other tools don't. Hence the
inconsistency.

Editing the pg_hba.conf (the usual recommendation) was never the right thing to do here. Finding that little password
filewas the trick. 

Regards
David M Bennett FACS

Andl - A New Database Language - andl.org