Re: pgpass.conf

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Ashish Karalkar <ashish(dot)karalkar(at)info-spectrum(dot)com>
Cc: Dave Page <dpage(at)postgresql(dot)org>, rod(at)iol(dot)ie, pgsql-general(at)postgresql(dot)org
Subject: Re: pgpass.conf
Date: 2007-07-10 11:13:03
Message-ID: 20070710111303.GH9020@svr2.hagander.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgadmin-support pgsql-general

On Tue, Jul 10, 2007 at 04:34:56PM +0530, Ashish Karalkar wrote:
> >>Hello All,
> >>
> >>I am trying tu run a script to create database from a batch programme
> >>and dont want to supply password everytime.
> >>So i tried to setup pgpass.conf file.
> >>File is kept in user profile/application data
> >>i.e
> >>C:\Documents and Settings\postgres\Application
> >>Data\postgresql\pgpass.conf
> >>
> >>file contains:
> >>
> >>localhost:5432 :*:postgres:mypass
> >>localhost:5432:qsweb:qsweb:mypass1
> >>
> >>Still the batch asks for the password.!!!
> >> I am just not getting why its not reading password from pgpass file.
> >>
> >>can anyone please figure out what is going wrong.
> >
> >Under what user account is the batch file being run? The pgpass.conf
> >file needs to be under *that* user account, which is not necessarily the
> >one that the postgresql server runs under.
> >
> >Regards, Dave
>
> The batch file is run under postgres user, also owner of the pgpass.conf
> file is postgres.
> As far as my knowledge the permission checking is not done on windows
> anyways the owner is same so i dont think there is any problem of permission
>
> from pg documents:
> "The permissions on .pgpass must disallow any access to world or group;
> achieve this by the command chmod 0600 ~/.pgpass. If the permissions are
> less strict than this, the file will be ignored. (The file permissions are
> not currently checked on Microsoft Windows, however.)"

That part is correct. But it's of course necessary that the user can *read*
the file, in order to get it's contents. But there is no check if others
can (on Windows).

So just to be sure of that, I suggest you try logging in as the user in
question and making sure you can read the file from that account.

//Magnus

In response to

Browse pgadmin-support by date

  From Date Subject
Next Message Dave Page 2007-07-10 11:19:44 Re: pgpass.conf
Previous Message Ashish Karalkar 2007-07-10 11:04:56 Re: pgpass.conf

Browse pgsql-general by date

  From Date Subject
Next Message Dave Page 2007-07-10 11:19:44 Re: pgpass.conf
Previous Message Ashish Karalkar 2007-07-10 11:04:56 Re: pgpass.conf