Thread: pgadmin4 won't use pgpass file
I'm running postgresql 11.1 (via unix socket only) and pgadmin 4.2 on linux.
I have a .pgpass file for the postgres user to a specific database but pgadmin4 keeps asking for a password. Using psql from the command line works fine.
my pgpass looks like the following
localhost:5432:newdb:postgres:**********
Setting up a connection to the server in pgadmin4 I tried the following:
General (tab):
Name = newdb admin
Connection (tab):
Host name/address = /var/run/postgresql
Port = 5432
Maintenance database = newdb
Username = postgres
Advanced (tab)
Password file = /home/saultdon/.pgpass
When I hit Save it says,
Unable to connect to server:
fe_sendauth: no password supplied
Where I thought it would use the pgpass file but it doesn't.
So I enter a password in the Connection(tab) just to make the first connection.
I relaunch pgadmin4 and try to connect to the db but it asks for a password with the error message:
fe_sendauth: no password supplied
Please enter the password for the user 'postgres' to connect to the server - "newdb"
I'm not sure what else I need to do to get pgadmin4 to use this .pgpass file.
Donovan (saultdon)
Have pgadmin access to that file? Check permissions of the folder and files
De: Saulteau Don <sault.don@gmail.com>
Enviado: Friday, February 15, 2019 1:56:08 PM
Para: pgadmin-support@lists.postgresql.org
Asunto: pgadmin4 won't use pgpass file
Enviado: Friday, February 15, 2019 1:56:08 PM
Para: pgadmin-support@lists.postgresql.org
Asunto: pgadmin4 won't use pgpass file
I'm running postgresql 11.1 (via unix socket only) and pgadmin 4.2 on linux.
I have a .pgpass file for the postgres user to a specific database but pgadmin4 keeps asking for a password. Using psql from the command line works fine.
my pgpass looks like the following
localhost:5432:newdb:postgres:**********
Setting up a connection to the server in pgadmin4 I tried the following:
General (tab):
Name = newdb admin
Connection (tab):
Host name/address = /var/run/postgresql
Port = 5432
Maintenance database = newdb
Username = postgres
Advanced (tab)
Password file = /home/saultdon/.pgpass
When I hit Save it says,
Unable to connect to server:
fe_sendauth: no password supplied
Where I thought it would use the pgpass file but it doesn't.
So I enter a password in the Connection(tab) just to make the first connection.
I relaunch pgadmin4 and try to connect to the db but it asks for a password with the error message:
fe_sendauth: no password supplied
Please enter the password for the user 'postgres' to connect to the server - "newdb"
I'm not sure what else I need to do to get pgadmin4 to use this .pgpass file.
Donovan (saultdon)
Hi Ignacio and Martuza, thanks for the pointers.
The file permissions were good and it turns out it was the host addr of localhost causing a problem.
I did have to change it to /var/run/postgresql
I originally used localhost because of the postgresql (was looking at OLD docs from 9.4! my mistake) docs and thought it would resolve to the default socket directory:
A host name of localhost matches both TCP (host name localhost) and Unix domain socket (pghost empty or the default socket directory) connections coming from the local machine.
On Sun, Feb 17, 2019 at 8:43 AM Murtuza Zabuawala <murtuza.zabuawala@enterprisedb.com> wrote:
The documents say`The host name field is matched to thehost
connection parameter if that is specified, otherwise to thehostaddr
parameter if that is specified; if neither are given then the host namelocalhost
is searched for. The host namelocalhost
is also searched for when the connection is a Unix-domain socket connection and thehost
parameter matches libpq's default socket directory path`So you need to provide the same value of the host field from server properties dialog into pgpass file.Can you try with following?/var/run/postgresql:5432:newdb:postgres:**********-- MurtuzaOn Sat, Feb 16, 2019 at 2:06 PM Saulteau Don <sault.don@gmail.com> wrote:I'm running postgresql 11.1 (via unix socket only) and pgadmin 4.2 on linux.I have a .pgpass file for the postgres user to a specific database but pgadmin4 keeps asking for a password. Using psql from the command line works fine.my pgpass looks like the followinglocalhost:5432:newdb:postgres:**********Setting up a connection to the server in pgadmin4 I tried the following:General (tab):Name = newdb adminConnection (tab):Host name/address = /var/run/postgresqlPort = 5432Maintenance database = newdbUsername = postgresAdvanced (tab)Password file = /home/saultdon/.pgpassWhen I hit Save it says,Unable to connect to server:fe_sendauth: no password suppliedWhere I thought it would use the pgpass file but it doesn't.So I enter a password in the Connection(tab) just to make the first connection.I relaunch pgadmin4 and try to connect to the db but it asks for a password with the error message:fe_sendauth: no password suppliedPlease enter the password for the user 'postgres' to connect to the server - "newdb"I'm not sure what else I need to do to get pgadmin4 to use this .pgpass file.Donovan (saultdon)