pgpass.conf

Started by Ashish Karalkarover 18 years ago14 messagesgeneral
Jump to latest
#1Ashish Karalkar
ashish.karalkar@info-spectrum.com

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

In reply to: Ashish Karalkar (#1)
Re: 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
---------------------------------------------------------------

#3Ashish Karalkar
ashish.karalkar@info-spectrum.com
In reply to: Ashish Karalkar (#1)
Re: pgpass.conf

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

In reply to: Ashish Karalkar (#3)
Re: pgpass.conf

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
---------------------------------------------------------------

#5Dave Page
dpage@pgadmin.org
In reply to: Ashish Karalkar (#1)
Re: 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

#6Ashish Karalkar
ashish.karalkar@info-spectrum.com
In reply to: Ashish Karalkar (#1)
Re: pgpass.conf

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

#7Magnus Hagander
magnus@hagander.net
In reply to: Ashish Karalkar (#6)
Re: pgpass.conf

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

#8Dave Page
dpage@pgadmin.org
In reply to: Ashish Karalkar (#6)
Re: pgpass.conf

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

#9Zlatko Matić
zlatko.matic1@sb.t-com.hr
In reply to: Ashish Karalkar (#1)
free scheduled import utility

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

#10Reid Thompson
Reid.Thompson@ateb.com
In reply to: Zlatko Matić (#9)
Re: free scheduled import utility

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

#11Dimitri Fontaine
dimitri@2ndQuadrant.fr
In reply to: Zlatko Matić (#9)
Re: free scheduled import utility

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

#12A. Kretschmer
andreas.kretschmer@schollglas.com
In reply to: Zlatko Matić (#9)
Re: free scheduled import utility

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

In reply to: Dave Page (#8)
Re: [GENERAL] pgpass.conf

On 10/07/2007 12:19, Dave Page wrote:

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

*ahem* Ray, not Rod. :-) (a common error, due to my email address)

Yes, that's what I meant.

Ray.

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

#14Dave Page
dpage@pgadmin.org
In reply to: Raymond O'Donnell (#13)
Re: [GENERAL] pgpass.conf

Raymond O'Donnell wrote:

On 10/07/2007 12:19, Dave Page wrote:

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

*ahem* Ray, not Rod. :-) (a common error, due to my email address)

Yes, that's what I meant.

Sorry Ray - in my defence I'm still a little tired from travelling. I
normally get it right after all!

Regards, Dave