pgadmin-org / pgadmin4

pgAdmin is the most popular and feature rich Open Source administration and development platform for PostgreSQL, the most advanced Open Source database in the world.
https://www.pgadmin.org
Other
2.27k stars 611 forks source link

Peer connection to postgres #6073

Open zzzzz0001 opened 1 year ago

zzzzz0001 commented 1 year ago

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

  1. Open pg_admin, go to register server
  2. You can fill in everything except the password as its already peer
  3. 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):

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
nikelborm commented 9 months ago

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