Re: .pgpass

From: <ghaverla(at)freenet(dot)edmonton(dot)ab(dot)ca>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: pgsql-novice(at)postgresql(dot)org
Subject: Re: .pgpass
Date: 2004-07-01 17:26:45
Message-ID: Pine.A41.3.95.1040701111932.26636A-100000@fn2.freenet.edmonton.ab.ca
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

On Thu, 1 Jul 2004, Tom Lane wrote:
> <ghaverla(at)freenet(dot)edmonton(dot)ab(dot)ca> writes:

> > I'm running Debian unstable, and I keep getting a message from a
> > cron job that wants to do.maintenance about no password being
> > supplied.
>
> > Now, I gather in the past a person had to explicitly put a
> > password in the cron job, but we are now supposed to use a file
> > called ~/.pgpass (~ being /var/lib/postgres).
>
> That is the recommended solution, but I'll bet that the cron job is not
> running with the same value of $HOME that you think it is, and so it is
> failing to find the file. You might want to explicitly set $HOME in the
> script.

Well, neither the cron script nor /etc/postgresql/postgresql.env
(which is sourced by the cron script) explicitly set $HOME. But
the message from cron indicates that home is /var/lib/postgres
and the user is postgres when the script runs.

X-Cron-Env: <SHELL=/bin/sh>
X-Cron-Env: <HOME=/var/lib/postgres>
X-Cron-Env: <PATH=/usr/bin:/bin>
X-Cron-Env: <LOGNAME=postgres>

> Also, test the .pgpass file by manually running psql with it; if there
> is something wrong with the file contents you'll be able to prove it...

Well, if I 'su - postgres' from root, and then run
'psql template1' everything works fine. I suppose I could edit
the .pgpass to contain a bad password, and see if psql fails. If
I put a bad password in .pgpass, the attempt to try psql fails.
So, psql is using .pgpass.

Gord

In response to

Responses

Browse pgsql-novice by date

  From Date Subject
Next Message Tom Lane 2004-07-01 17:34:41 Re: concurrent cursors possible with portals?
Previous Message M. Bastin 2004-07-01 17:24:36 Re: concurrent cursors possible with portals?