pgadmin4 icon indicating copy to clipboard operation
pgadmin4 copied to clipboard

Peer connection to postgres

Open zzzzz0001 opened this issue 2 years ago • 2 comments

This bug exists only in pgadmin and is not seen if you do it through the ubuntu terminal

So this bug comes up with authentication in pg_hba.conf file having peer authentication than scram-sha-256

To Reproduce

Steps to reproduce the behavior:

  1. Get a fresh installation or create a new cluster of postgres (i have tested with 14) in ubuntu
  2. By default ubuntu installation for postgres is such that the pg_hba file is having peer connection so you don't need a password to log in
  3. Test it in the terminal with these two codes executed in order (note: i created a cluster so the port is 5433)
sudo -iu postgres
psql -p 5433

This would just log in to postgres database. Now let's try with pgadmin 4. Open pg_admin, go to register server 5. You can fill in everything except the password as its already peer 6. Clicking on the "save" button will not save it, it will end up in an error.

Expected behavior It should be logging me in as the database doesn't need a password.

Error message

"Unable to connect to the server: connection to the server at "localhost" (127.0.0.1), port 5433 failed: fe_sendauth: no password supplied"

Desktop (please complete the following information):

  • OS: Ubuntu 20.04
  • Version: 6.21 (I have seen this behavior for a lot of previous versions of pgadmin but I was a bit lazy to report this)
  • Mode: not sure what this means but I just downloaded it from the apt method given

I will show you all codes I used to install pgadmin that I put in the terminal (ref: https://www.pgadmin.org/download/pgadmin-4-apt/)

curl -fsS https://www.pgadmin.org/static/packages_pgadmin_org.pub | sudo gpg --dearmor -o /usr/share/keyrings/packages-pgadmin-org.gpg

sudo sh -c 'echo "deb [signed-by=/usr/share/keyrings/packages-pgadmin-org.gpg] https://ftp.postgresql.org/pub/pgadmin/pgadmin4/apt/$(lsb_release -cs) pgadmin4 main" > /etc/apt/sources.list.d/pgadmin4.list && apt update'

sudo apt install pgadmin4

zzzzz0001 avatar Mar 31 '23 20:03 zzzzz0001

Maybe related: https://github.com/pgadmin-org/pgadmin4/issues/6741#issuecomment-1722212595

nikelborm avatar Sep 16 '23 11:09 nikelborm

Hi,

I have almost the same problem but with cert authentification than peer or scram-sha-256, pgadmin keep asking me for a password thought login is done by certificate.

vlaborie avatar Aug 13 '24 08:08 vlaborie