Re: Preventing psql from attempting to access ~/.pgpass file.

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: Allan Kamau <kamauallan(at)gmail(dot)com>
Cc: Postgres General Postgres General <pgsql-general(at)postgresql(dot)org>
Subject: Re: Preventing psql from attempting to access ~/.pgpass file.
Date: 2017-10-17 06:19:31
Message-ID: 20171017061931.GA13880@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Tue, Oct 17, 2017 at 09:06:59AM +0300, Allan Kamau wrote:
> Is there a way to instruct psql not to try reading ~/.pgpass file?

https://www.postgresql.org/docs/current/static/libpq-envars.html
PGPASSFILE behaves the same as the passfile connection parameter.
passfile
Specifies the name of the file used to store passwords (see Section 33.15). Defaults to ~/.pgpass, or %APPDATA%\postgresql\pgpass.conf on Microsoft Windows. (No error is reported if this file does not exist.)

https://www.postgresql.org/docs/9.6/static/libpq-envars.html
PGPASSFILE specifies the name of the password file to use for lookups. If not set, it defaults to ~/.pgpass (see Section 31.15).

verifying it doesn't access the default:
pryzbyj(at)pryzbyj:~$ echo quit |PGPASSFILE=/nonextant strace psql 2>&1 |grep -E 'nonex|pgpass'
stat("/nonextant", 0x7fffbd13c9f0) = -1 ENOENT (No such file or directory)
pryzbyj(at)pryzbyj:~$

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Murtuza Zabuawala 2017-10-17 06:23:59 Re: Preventing psql from attempting to access ~/.pgpass file.
Previous Message Thomas Kellerer 2017-10-17 06:11:38 Re: Making subscribers read only in Postgres 10 logical replication