Changing the admin/postgres user password
Changing the admin/postgres user password
От:
Jeffrey Walton <noloader@gmail.com>
Дата:
Hi Everyone,
I'm struggling to set the admin/postgres user password and use it on
Fedora 36. This is a fresh install on a new VM. The admin's name is
postgres. We created the user, and used the passwd utility to set the
Linux password 'hi...HS'. The ellipses are over 28 characters, so it
is a 32-character password.
Next, move onto Postgres auth. I followed
https://www.postgresql.org/docs/current/install-short.html . We used
'su - postgres' and logged on with Linux password. I changed the
postgres password with 'alter user postgres with password hi...HS'.
The change appeared to be successful.
Next, restart the service:
sudo systemctl restart postgresql.service
And finally, try the new password:
PGPASSWORD=hi...HS psql -U postgres
psql: error: connection to server on socket
"/var/run/postgresql/.s.PGSQL.5432" failed:
FATAL: Peer authentication failed for user "postgres"
It appears the password is not working. I screwed something up somewhere. Ugh...
Does anyone know what I did wrong in this process?
Or maybe better, what part of the manual discusses auth failures so I
can read about them?
Thanks in advance.
Jeff
Re: Changing the admin/postgres user password
От:
Christophe Pettus <xof@thebuild.com>
Дата:
> On Sep 5, 2022, at 19:40, Jeffrey Walton wrote: > And finally, try the new password: > > PGPASSWORD=hi...HS psql -U postgres > psql: error: connection to server on socket > "/var/run/postgresql/.s.PGSQL.5432" failed: > FATAL: Peer authentication failed for user "postgres" If it's complaining about peer authentication, you are most likely not logged in as the "postgres" Linux user. If you want other Linux users to be able to log in as the "postgres" PostgreSQL user, you'll need to edit your pg_hba.conf file to allow it; it's off by default.
Re: Changing the admin/postgres user password
От:
"David G. Johnston" <david.g.johnston@gmail.com>
Дата:
On Mon, Sep 5, 2022 at 7:40 PM Jeffrey Walton <noloader@gmail.com> wrote:
Or maybe better, what part of the manual discusses auth failures so I
can read about them?
The chapter named "Client Authentication ".
It even has a subchapter named "Authentication Problems" though it seems like discussion of (typical) default peer dynamics is missing.
In particular, if you connect via local socket (also a default) the order of entries in (typical default) pg_hba.conf says you must login using peer, not password.
David J.