pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Win32 Postgresql Command Line Password Specification
4+ messages / 4 participants
[nested] [flat]

* Win32 Postgresql Command Line Password Specification
@ 2005-02-08 08:11  Andrei Bintintan <klodoma@ar-sd.net>
  0 siblings, 3 replies; 4+ messages in thread

From: Andrei Bintintan @ 2005-02-08 08:11 UTC (permalink / raw)
  To: pgsql-admin

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] 4+ messages in thread

* Re: Win32 Postgresql Command Line Password Specification
@ 2005-02-08 08:37  Iain <iain@mst.co.jp>
  parent: Andrei Bintintan <klodoma@ar-sd.net>
  2 siblings, 0 replies; 4+ messages in thread

From: Iain @ 2005-02-08 08:37 UTC (permalink / raw)
  To: Andrei Bintintan <klodoma@ar-sd.net>; pgsql-admin

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] 4+ messages in thread

* Re: Win32 Postgresql Command Line Password Specification
@ 2005-02-08 09:01  Tom Arthurs <tom@jobflash.com>
  parent: Andrei Bintintan <klodoma@ar-sd.net>
  2 siblings, 0 replies; 4+ messages in thread

From: Tom Arthurs @ 2005-02-08 09:01 UTC (permalink / raw)
  To: Andrei Bintintan <klodoma@ar-sd.net>; +Cc: pgsql-admin

Not sure if it will work in windows, but in unix, I use the envrionmental variable PGPASSWORD

Not the safest thing in the world, but in my case, if a hacker's gotten through two layers of firewall, I'm sunk anyhow. :)

Andrei Bintintan wrote:

> 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] 4+ messages in thread

* Re: Win32 Postgresql Command Line Password Specification
@ 2005-02-08 13:38  John DeSoi <desoi@pgedit.com>
  parent: Andrei Bintintan <klodoma@ar-sd.net>
  2 siblings, 0 replies; 4+ messages in thread

From: John DeSoi @ 2005-02-08 13:38 UTC (permalink / raw)
  To: Andrei Bintintan <klodoma@ar-sd.net>; +Cc: pgsql-admin


On Feb 8, 2005, at 3:11 AM, Andrei Bintintan wrote:

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


The recommended method is to use the pgpass.conf file on Windows:

http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html

There is also a PGPASSWORD environment variable, but this is 
depreciated for security reasons.


John DeSoi, Ph.D.
http://pgedit.com/
Power Tools for PostgreSQL




^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2005-02-08 13:38 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-02-08 08:11 Win32 Postgresql Command Line Password Specification Andrei Bintintan <klodoma@ar-sd.net>
2005-02-08 08:37 ` Iain <iain@mst.co.jp>
2005-02-08 09:01 ` Tom Arthurs <tom@jobflash.com>
2005-02-08 13:38 ` John DeSoi <desoi@pgedit.com>

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