Thread: pgpass.conf

pgpass.conf

From
"Ashish Karalkar"
Date:
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.
 
Thanks in Advance
Ashish...
 
 
 
 
 
 
 
 

Re: pgpass.conf

From
Raymond O'Donnell
Date:
On 10/07/2007 08:47, Ashish Karalkar wrote:

> Still the batch asks for the password.!!!
>  I am just not getting why its not reading password from pgpass file.

Probably a silly question, but if you're using the createdb utility in
the batch file, have you inadvertently included the -W option? - this
forces a password prompt.

Ray.


---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------

Re: pgpass.conf

From
"Ashish Karalkar"
Date:
----- Original Message -----
From: "Raymond O'Donnell" <rod@iol.ie>
To: "Ashish Karalkar" <ashish.karalkar@info-spectrum.com>
Cc: <pgsql-general@postgresql.org>
Sent: Tuesday, July 10, 2007 3:51 PM
Subject: Re: [GENERAL] pgpass.conf


> On 10/07/2007 08:47, Ashish Karalkar wrote:
>
>> Still the batch asks for the password.!!!
>>  I am just not getting why its not reading password from pgpass file.
>
> Probably a silly question, but if you're using the createdb utility in the
> batch file, have you inadvertently included the -W option? - this forces a
> password prompt.
>
> Ray.
>
>
> ---------------------------------------------------------------
> Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
> rod@iol.ie
> ---------------------------------------------------------------

Thanks Ray for your replay,

No I haven't  included -W option.

I have set this succesfully on redhat linux but iam messed up in Windows XP
prof.

Is there any other thing to do?

Thanks in advance
Ashish...


Re: pgpass.conf

From
Raymond O'Donnell
Date:
On 10/07/2007 11:28, Ashish Karalkar wrote:

> I have set this succesfully on redhat linux but iam messed up in Windows
> XP prof.
>
> Is there any other thing to do?

I'm not a guru, but maybe it's a permissions problem on the pgpass file?

Ray.


---------------------------------------------------------------
Raymond O'Donnell, Director of Music, Galway Cathedral, Ireland
rod@iol.ie
---------------------------------------------------------------

Re: pgpass.conf

From
Dave Page
Date:
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

Re: pgpass.conf

From
"Ashish Karalkar"
Date:
----- Original Message -----
From: "Dave Page" <dpage@postgresql.org>
To: "Ashish Karalkar" <ashish.karalkar@info-spectrum.com>
Cc: <pgsql-general@postgresql.org>
Sent: Tuesday, July 10, 2007 4:25 PM
Subject: Re: [GENERAL] pgpass.conf


> 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.)"



Re: pgpass.conf

From
Magnus Hagander
Date:
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

Re: pgpass.conf

From
Dave Page
Date:
Ashish Karalkar wrote:
> 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
>

OK - have you tried 127.0.0.1 instead of localhost in the pgpass file?

> "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's referring to the checks we do on *nix to ensure the file is
secure enough, rather than whether or not the client program can read it
which is what Rod was suggesting I think. The Windows ACL model is
sufficiently more complex that doing that check is far harder than it is
on *nix, and the Application Data directory should be secure anyway
(unless you're using FAT32, but then there's no helping you anyway :-) ).

Regards, Dave



free scheduled import utility

From
"Zlatko Matic"
Date:
Hello.
Is there any free program/utility for batch imports from .csv files, that
can be easily scheduled for daily inserts of data to PostgreSQL tables?
Regards,

Zlatko


Re: free scheduled import utility

From
Reid Thompson
Date:
On Tue, 2007-07-10 at 14:32 +0200, Zlatko Matic wrote:
> Hello.
> Is there any free program/utility for batch imports from .csv files, that
> can be easily scheduled for daily inserts of data to PostgreSQL tables?
> Regards,
>
> Zlatko
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: don't forget to increase your free space map settings

cron, psql and http://www.postgresql.org/docs/8.2/static/sql-copy.html

Re: free scheduled import utility

From
Dimitri Fontaine
Date:
Le mardi 10 juillet 2007, Zlatko Matic a écrit :
> Is there any free program/utility for batch imports from .csv files, that
> can be easily scheduled for daily inserts of data to PostgreSQL tables?

COPY itself would do the job, but you can also use pgloader:
  http://pgfoundry.org/projects/pgloader

It has many options, and is able to load data in the presence of errors,
logging them (both error.log and reject.log).

Hope this helps, regard,
--
dim

Attachment

Re: free scheduled import utility

From
"A. Kretschmer"
Date:
am  Tue, dem 10.07.2007, um 14:32:58 +0200 mailte Zlatko Matic folgendes:
> Hello.
> Is there any free program/utility for batch imports from .csv files, that
> can be easily scheduled for daily inserts of data to PostgreSQL tables?
> Regards,

You can use the scheduler from your OS. For Unix-like systems is this
the CRON, with windows i'm not familiar.


Andreas
--
Andreas Kretschmer
Kontakt:  Heynitz: 035242/47150,   D1: 0160/7141639 (mehr: -> Header)
GnuPG-ID:   0x3FFF606C, privat 0x7F4584DA   http://wwwkeys.de.pgp.net