Thread: Postgres Service active with errors

Postgres Service active with errors

From
nikhil raj
Date:

Hi All,

I can connect to Postgres, but when checking the status of the services, I am getting the following error:


May 23 18:23:13 PG2433 systemd[1]: Starting PostgreSQL Cluster 13-main... May 23 18:23:21 PG2433 postgresql@13-main[39428]: Warning: connection to the database failed, disabling startup checks: May 23 18:23:21 PG2433 postgresql@13-main[39428]: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: fe_sendauth: no password supplied May 23 18:23:21 PG2433 systemd[1]: Started PostgreSQL Cluster 13-main.

When I set the database administrative login by Unix domain socket authentication to md5 or scram-sha-256, it gives the above error in status, but setting it to trust is a compliance issue.

Here is the relevant configuration in the pg_hba.conf file:

# Database administrative login by Unix domain socket local all all md5 # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all scram-sha-256 # IPv4 local connections: hostssl all all 0.0.0.0/0 scram-sha-256 # IPv6 local connections: host all all ::1/128 scram-sha-256 # Allow replication connections from localhost, by a user with the # replication privilege. local replication all peer host replication all 127.0.0.1/32 md5 host replication all ::1/128 md5

And here is the relevant part of the postgresql.conf file:

listen_addresses = '*' password_encryption = scram-sha-256


.

Re: Postgres Service active with errors

From
"David G. Johnston"
Date:


On Thu, May 23, 2024, 16:52 nikhil raj <nikhilraj474@gmail.com> wrote:

Hi All,

I can connect to Postgres, but when checking the status of the services, I am getting the following error:


May 23 18:23:13 PG2433 systemd[1]: Starting PostgreSQL Cluster 13-main... May 23 18:23:21 PG2433 postgresql@13-main[39428]: Warning: connection to the database failed, disabling startup checks: May 23 18:23:21 PG2433 postgresql@13-main[39428]: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: fe_sendauth: no password supplied
You are requiring a password but not configuring psql to send one.  Either change the psql invocation or don't require a password - via peer, not trust.

May 23 18:23:21 PG2433 systemd[1]: Started PostgreSQL Cluster 13-main.

When I set the database administrative login by Unix domain socket authentication to md5 or scram-sha-256, it gives the above error in status, but setting it to trust is a compliance issue.


Most people use "peer".

Here is the relevant configuration in the pg_hba.conf file:

# Database administrative login by Unix domain socket local all all md5 # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all
scram-sha-256

The second one is unused.  And since you want scram it is actually the one you should be using.

You are failing to show any context surrounding the psql connection attempt producing the failure.  You need to track that down and either fix it or show the context when asking for further help.

David J.

Re: Postgres Service active with errors

From
Ron Johnson
Date:
On Thu, May 23, 2024 at 6:52 PM nikhil raj <nikhilraj474@gmail.com> wrote:

Hi All,

I can connect to Postgres, but when checking the status of the services, I am getting the following error:


May 23 18:23:13 PG2433 systemd[1]: Starting PostgreSQL Cluster 13-main... May 23 18:23:21 PG2433 postgresql@13-main[39428]: Warning: connection to the database failed, disabling startup checks: May 23 18:23:21 PG2433 postgresql@13-main[39428]: psql: error: connection to server on socket "/var/run/postgresql/.s.PGSQL.5432" failed: fe_sendauth: no password supplied May 23 18:23:21 PG2433 systemd[1]: Started PostgreSQL Cluster 13-main.

When I set the database administrative login by Unix domain socket authentication to md5 or scram-sha-256, it gives the above error in status, but setting it to trust is a compliance issue.

Here is the relevant configuration in the pg_hba.conf file:

# Database administrative login by Unix domain socket local all all md5 # TYPE DATABASE USER ADDRESS METHOD # "local" is for Unix domain socket connections only local all all scram-sha-256 # IPv4 local connections: hostssl all all 0.0.0.0/0 scram-sha-256
local/sockets authentication is, by default, peer authentication.  PG knows the user is authenticated because Linux has already authenticated the account.