Peer authentication failed for user "postgres"
This document (000022003) is provided subject to the disclaimer at the end of this document.
Environment
SUSE Manager Server 5.0.x
Situation
A connection attempt to PostgreSQL as the `postgres` user using `psql -U postgres` may fail with the following error.
uyuni-server:/ # psql -U postgres
psql: error: connection to server on socket "/run/postgresql/.s.PGSQL.5432" failed: FATAL: Peer authentication failed for user "postgres"
Resolution
To access the PostgreSQL database (for example, `susemanager`), use the following command:
uyuni-server:~ # sudo -u postgres psql susemanager
Cause
The "Peer authentication failed" message occurs because PostgreSQL is configured to use peer authentication for local `postgres` users.
With peer authentication, the OS user needs to match the PostgreSQL user being connected. If the OS login user is not `postgres`, the connection attempt will fail.
To prevent this message from appearing, `sudo` can be used to switch to the `postgres` user.
Disclaimer
This Support Knowledgebase provides a valuable tool for SUSE customers and parties interested in our products and solutions to acquire information, ideas and learn from one another. Materials are provided for informational, personal or non-commercial use within your organization and are presented "AS IS" WITHOUT WARRANTY OF ANY KIND.
- Document ID:000022003
- Creation Date: 22-Aug-2025
- Modified Date:26-Aug-2025
-
- SUSE Manager Server
For questions or concerns with the SUSE Knowledgebase please contact: tidfeedback[at]suse.com