Re: .pgpass not working

From: Rebecca Clarke <r(dot)clarke83(at)gmail(dot)com>
To: Ben Chobot <bench(at)silentmedia(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: .pgpass not working
Date: 2012-05-08 16:16:44
Message-ID: CAMChtdeOyW79V_8i2y4w5pj2qMQaTW6i+yph5NicSB3J2pA6tQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hi Ben

I had saved the .pgpass file in my home directory /home/user/.pgpass which
works when I'm logged in as user. However, in order for me to use Slony, I
had to be logged in as postgres user.
I installed strace and ran my pg_dump test and found that it actually looks
for the .pgpass file in /var/lib/postgresql (which I'm assuming is the
postgres users home directory as this is the directory where I begin in
when I log in).
I made a copy of the .pgpass and saved it in that location and it worked!

Many thanks.

Rebecca

On Fri, May 4, 2012 at 6:35 PM, Ben Chobot <bench(at)silentmedia(dot)com> wrote:

> On May 4, 2012, at 9:30 AM, Rebecca Clarke wrote:
>
> I do not want to touch the pg_hba.conf so I have generated the .pgpass
> file.
> The permissions is set to 600, and I have correctly inputted the details
> into .pgpass, there are no leading spaces.
>
> *myhostname:myport:*:postgres:mypassword*
>
> However I am still prompted for a password.
> I have tested pg_dump as well and it prompts also.
>
> Does anyone have any suggestions on what may be the culprit. Is there
> somewhere I need to specify to tell the system to look into the .pgpass
> file?
>
>
> Where is the .pgpass file? If it's not in ~/.pgpass or doesn't have the
> right ownership (your permissions are good) then it won't be used. If it's
> in a different location, you might need to make use of the PGPASSFILE
> environment variable.
>
> If you really get stuck, you can always strace psql or pg_dump and see if
> it has problems opening your .pgpass file.
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Richard Harley 2012-05-08 17:27:16 relpages sudden increase
Previous Message deepak 2012-05-08 16:13:22 Re: FATAL: lock file "postmaster.pid" already exists