pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedRe: Win32 Postgresql Command Line Password
5+ messages / 5 participants
[nested] [flat]
* Re: Win32 Postgresql Command Line Password
@ 2005-02-08 09:36 John Jensen <JRJ@ft.fo>
2005-02-08 10:09 ` Re: Win32 Postgresql Command Line Password Iain <iain@mst.co.jp>
0 siblings, 1 reply; 5+ messages in thread
From: John Jensen @ 2005-02-08 09:36 UTC (permalink / raw)
To: klodoma@ar-sd.net; iain@mst.co.jp; pgsql-admin
This might not apply to the win32 version. But in the Unix version you
can
put this information in a .pgpass file. This enables you to keep
passwords
on all user accounts and still be able to automate tasks.
There is a number of permission/ownership requirements on this file in
the Unix version. These might not be compatible with win32 so use at
your
own perril ;-). And check the manual ...
I currently use this approach on a Linux box for automating the
maintenance
tasks through cron jobs.
Cheers,
John
>>> "Iain" <iain@mst.co.jp> 08-02-2005 08:37:54 >>>
I think that's the best way to do it.
Rather than leave passwords lying around in script files, it might be
best
to trust a specific (specially created) user when running from a
specific
location on the specific database. Then you just have to keep that user
account secure. I can imagine how it would work wth linux, but am not
sure
what problems youmay face under windows.
The only other alternative I can imagine is to use another program to
type
the password in automatically. I've never done it but I'm sure such a
beast
must exist.
The long and the short of it is (at least upto 7.4.6 - I don't know
about
later versions) thereis no way to specify the password on the
commandline.
Regards
Iain
----- Original Message -----
From: Andrei Bintintan
To: pgsql-admin@postgresql.org
Sent: Tuesday, February 08, 2005 5:11 PM
Subject: [ADMIN] Win32 Postgresql Command Line Password
Specification
Hi,
I have to run some command line commands that I have to run on a
windows
machine. Like pgsql, dropdb, createdb etc.
All these commands are runned from a php scripts.
Now, my question is how can I specify a User and Password to
postgresql
database system. I found out how can I say the user, but the password
is
always asked in the command line. I need this also to be specified in
the
command.
for example: dropdb database1 -U postgres -W.... always ask a
password in
the command line.
I want to specify in the command line the pass.
The only solution that I found for this problem is to put the postgre
user
autentication to trust and to skip the password.
Andy.
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Win32 Postgresql Command Line Password
2005-02-08 09:36 Re: Win32 Postgresql Command Line Password John Jensen <JRJ@ft.fo>
@ 2005-02-08 10:09 ` Iain <iain@mst.co.jp>
0 siblings, 0 replies; 5+ messages in thread
From: Iain @ 2005-02-08 10:09 UTC (permalink / raw)
To: John Jensen <JRJ@ft.fo>; klodoma@ar-sd.net; pgsql-admin
Hi John,
I havn't spent much time in that section of the documentation, a situation
which should probably be rectified.
Using ~/.pgpass would seem to do the job, and may even be a good solution
under unix/linux.
I don't feel qualified to get into a debate over the relative pros and cons
of trust vs .pgpass, but maybe someone else has something to say.
Also, I noticed that the PGPASSPORD environment variable is deprecated, so
probably best to avoid it if possible.
regards
Iain
----- Original Message -----
From: "John Jensen" <JRJ@ft.fo>
To: <klodoma@ar-sd.net>; <iain@mst.co.jp>; <pgsql-admin@postgresql.org>
Sent: Tuesday, February 08, 2005 6:36 PM
Subject: Re: [ADMIN] Win32 Postgresql Command Line Password
> This might not apply to the win32 version. But in the Unix version you
> can
> put this information in a .pgpass file. This enables you to keep
> passwords
> on all user accounts and still be able to automate tasks.
>
> There is a number of permission/ownership requirements on this file in
> the Unix version. These might not be compatible with win32 so use at
> your
> own perril ;-). And check the manual ...
>
> I currently use this approach on a Linux box for automating the
> maintenance
> tasks through cron jobs.
>
> Cheers,
> John
>
>>>> "Iain" <iain@mst.co.jp> 08-02-2005 08:37:54 >>>
> I think that's the best way to do it.
>
> Rather than leave passwords lying around in script files, it might be
> best
> to trust a specific (specially created) user when running from a
> specific
> location on the specific database. Then you just have to keep that user
>
> account secure. I can imagine how it would work wth linux, but am not
> sure
> what problems youmay face under windows.
>
> The only other alternative I can imagine is to use another program to
> type
> the password in automatically. I've never done it but I'm sure such a
> beast
> must exist.
>
> The long and the short of it is (at least upto 7.4.6 - I don't know
> about
> later versions) thereis no way to specify the password on the
> commandline.
>
> Regards
> Iain
> ----- Original Message -----
> From: Andrei Bintintan
> To: pgsql-admin@postgresql.org
> Sent: Tuesday, February 08, 2005 5:11 PM
> Subject: [ADMIN] Win32 Postgresql Command Line Password
> Specification
>
>
> Hi,
>
> I have to run some command line commands that I have to run on a
> windows
> machine. Like pgsql, dropdb, createdb etc.
> All these commands are runned from a php scripts.
>
> Now, my question is how can I specify a User and Password to
> postgresql
> database system. I found out how can I say the user, but the password
> is
> always asked in the command line. I need this also to be specified in
> the
> command.
>
> for example: dropdb database1 -U postgres -W.... always ask a
> password in
> the command line.
> I want to specify in the command line the pass.
>
> The only solution that I found for this problem is to put the postgre
> user
> autentication to trust and to skip the password.
>
> Andy.
>
> ---------------------------(end of broadcast)---------------------------
> TIP 7: don't forget to increase your free space map settings
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Win32 Postgresql Command Line Password
@ 2005-02-08 11:36 Magnus Hagander <mha@sollentuna.net>
0 siblings, 0 replies; 5+ messages in thread
From: Magnus Hagander @ 2005-02-08 11:36 UTC (permalink / raw)
To: John Jensen <JRJ@ft.fo>; klodoma@ar-sd.net; iain@mst.co.jp; pgsql-admin
> This might not apply to the win32 version. But in the Unix
> version you can put this information in a .pgpass file. This
> enables you to keep passwords on all user accounts and still
> be able to automate tasks.
It applies to win32 as well, only the file is called "pgpass.conf", see
http://www.postgresql.org/docs/8.0/static/libpq-pgpass.html
> There is a number of permission/ownership requirements on
> this file in the Unix version. These might not be compatible
> with win32 so use at your own perril ;-). And check the manual ...
No permissions checks are done on the file in win32. The default
permissions on the directory is very restrictive, but if you change it
then you'reo n your own.
//Magnus
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Win32-postgresql command line password
@ 2005-02-10 18:04 Pascal Van Puymbroeck <pascal.vanpuymbroeck@zenonproductions.be>
2005-02-10 18:16 ` Re: Win32-postgresql command line password Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 1 reply; 5+ messages in thread
From: Pascal Van Puymbroeck @ 2005-02-10 18:04 UTC (permalink / raw)
To: pgsql-admin
I'm not sure if this is the best method but I use the:
pgsql -d dbase -U ppk -f e:\\Test.imp < passwd.txt
Where passwd.txt holds the password for the user specified.
Hope this helps you out.
Pascal Van Puymbroeck
ZENON productions bvba
^ permalink raw reply [nested|flat] 5+ messages in thread
* Re: Win32-postgresql command line password
2005-02-10 18:04 Re: Win32-postgresql command line password Pascal Van Puymbroeck <pascal.vanpuymbroeck@zenonproductions.be>
@ 2005-02-10 18:16 ` Bruce Momjian <pgman@candle.pha.pa.us>
0 siblings, 0 replies; 5+ messages in thread
From: Bruce Momjian @ 2005-02-10 18:16 UTC (permalink / raw)
To: Pascal Van Puymbroeck <pascal.vanpuymbroeck@zenonproductions.be>; +Cc: pgsql-admin
Pascal Van Puymbroeck wrote:
> I'm not sure if this is the best method but I use the:
>
> pgsql -d dbase -U ppk -f e:\\Test.imp < passwd.txt
>
> Where passwd.txt holds the password for the user specified.
Also see .pgpass in the libpq manual section. It allows you to store
passwords in a file for use by psql and all other libpq applications.
On Win32 the file is stored in %APPDATA%\postgresql\pgpass.conf.
We should mention this in the psql manual page and I will add a mention
for 8.1. Thanks.
--
Bruce Momjian | http://candle.pha.pa.us
pgman@candle.pha.pa.us | (610) 359-1001
+ If your life is a hard drive, | 13 Roberts Road
+ Christ can be your backup. | Newtown Square, Pennsylvania 19073
^ permalink raw reply [nested|flat] 5+ messages in thread
end of thread, other threads:[~2005-02-10 18:16 UTC | newest]
Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-08 09:36 Re: Win32 Postgresql Command Line Password John Jensen <JRJ@ft.fo>
2005-02-08 10:09 ` Iain <iain@mst.co.jp>
2005-02-08 11:36 Re: Win32 Postgresql Command Line Password Magnus Hagander <mha@sollentuna.net>
2005-02-10 18:04 Re: Win32-postgresql command line password Pascal Van Puymbroeck <pascal.vanpuymbroeck@zenonproductions.be>
2005-02-10 18:16 ` Re: Win32-postgresql command line password Bruce Momjian <pgman@candle.pha.pa.us>
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox