Обсуждение: dblink authentication issue

Поиск
Список
Период
Сортировка

dblink authentication issue

От
Daulat
Дата:
Hello,

I have some problem with using dblink_connect_u() while making a connection using a .pgpass file. 


select * from gis.dblink_connect_u('conn'||'X123','dbname='||'pgdb');
ERROR:  could not establish connection
DETAIL:  fe_sendauth: no password supplied


The .pgpass file is under postgres user home (home/postgres/.pgpass) and has 0600 permission and postgres group. 


I am able to connect with the ./pgpass file without using a user password.


:/opt/PostgreSQL-14/bin$ ./psql -d postgres -U postgres
psql (14.6)
Type "help" for help.

postgres=#


pg_hba.conf have the following entry:


host    all             all                    127.0.0.1/32        md5


.pgpass have :


*:5432:*:postgres:2WSX#E86qrfv


I tried with the below (localhost and 127.0.0.1 and  IP) also but no success.
localhost:5432:*:postgres:2WSX#E86qrfv

127..0.0.1:5432:*:postgres:2WSX#E86qrfv

110.24.30.100:5432:*:postgres:2WSX#E86qrfv


When I provide the password in the connection string, there is no problem, but when I don’t, it says:


select * from gis.dblink_connect_u('conn'||'X123','dbname='||'gisdb');
ERROR:  could not establish connection
DETAIL:  fe_sendauth: no password supplied


My Postgres server is running on Ubuntu, version 18.04.1 with PostgreSQL 14.6




Thanks,





Re: dblink authentication issue

От
Tom Lane
Дата:
Daulat <daulat.dba@gmail.com> writes:
> I have some problem with using dblink_connect_u() while making a connection
> using a .pgpass file.
> select * from gis.dblink_connect_u('conn'||'X123','dbname='||'pgdb');
> ERROR:  could not establish connection
> DETAIL:  fe_sendauth: no password supplied

This is intentional: to use a .pgpass file belonging to the server owner,
you must be a database superuser.

            regards, tom lane



Re: dblink authentication issue

От
Daulat
Дата:
Yes, I am using superuser "postgres". 
It is the owner of the .pgpass file.

Thanks,




On Fri, Apr 21, 2023 at 7:51 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
Daulat <daulat.dba@gmail.com> writes:
> I have some problem with using dblink_connect_u() while making a connection
> using a .pgpass file.
> select * from gis.dblink_connect_u('conn'||'X123','dbname='||'pgdb');
> ERROR:  could not establish connection
> DETAIL:  fe_sendauth: no password supplied

This is intentional: to use a .pgpass file belonging to the server owner,
you must be a database superuser.

                        regards, tom lane