supplying password to psql on command line?

Поиск
Список
Период
Сортировка
Искать

supplying password to psql on command line?

От:
Stan Letovsky <stan@morgan.harvard.edu>
Дата:
Is this possible? The documentation is silent in this point. SYBASE
isql allows this by flag or environment variable.

Cheers, -Stan

Re: supplying password to psql on command line?

От:
Andrew Sullivan <andrew@libertyrms.info>
Дата:
On Thu, Oct 24, 2002 at 10:59:10AM -0400, Stan Letovsky wrote:
> Is this possible? The documentation is silent in this point. SYBASE
> isql allows this by flag or environment variable.

Try the environment variable PGPASSWORD.

A

-- 
----
Andrew Sullivan                         204-4141 Yonge Street
Liberty RMS                           Toronto, Ontario Canada
                              M2P 2A8
                                         +1 416 646 3304 x110

Re: supplying password to psql on command line?

От:
Christoph Dalitz <christoph.dalitz@hs-niederrhein.de>
Дата:
> Date: Thu, 24 Oct 2002 10:59:10 -0400 (EDT)
> From: Stan Letovsky 
> 
> Is this possible? The documentation is silent in this point. SYBASE
> isql allows this by flag or environment variable.
> 
Use the environment variable PGPASSWORD.

Christoph Dalitz

Re: supplying password to psql on command line?

От:
Medi Montaseri <medi.montaseri@intransa.com>
Дата:
I think Font ends are moving away from this approach as others can see 
your supplied
passwd by a simple ps(1) command.

Stan Letovsky wrote:

>Is this possible? The documentation is silent in this point. SYBASE
>isql allows this by flag or environment variable.
>
>Cheers, -Stan
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 4: Don't 'kill -9' the postmaster
>  
>



Re: supplying password to psql on command line?

От:
Christoph Dalitz <christoph.dalitz@hs-niederrhein.de>
Дата:

> Date: Mon, 28 Oct 2002 10:56:32 -0800
> From: Medi Montaseri 
> 
> I think Font ends are moving away from this approach as others can see 
> your supplied
> passwd by a simple ps(1) command.
>
There used to be a program "hide.c" available from the oracle website,
which made this impossible. Unfortunately I can no longer find it.

A simpler approach however is to supply the password from stdin.
With Oracle's sqlplus this works as follows:

	#!/bin/sh

	sqlplus <

Re: supplying password to psql on command line?

От:
Christoph Dalitz <christoph.dalitz@hs-niederrhein.de>
Дата:
> > I think Font ends are moving away from this approach as others can see 
> > your supplied
> > passwd by a simple ps(1) command.
> >
> There used to be a program "hide.c" available from the oracle website,
> which made this impossible. Unfortunately I can no longer find it.
>
Found it here:
ftp://ftp.usg.edu/pub/oracle/security/hideargs/

Christoph Dalitz

Re: supplying password to psql on command line?

От:
Alvaro Herrera <alvherre@dcc.uchile.cl>
Дата:
On Tue, Oct 29, 2002 at 08:52:12AM +0100, Christoph Dalitz wrote:
> 
> > Date: Mon, 28 Oct 2002 10:56:32 -0800
> > From: Medi Montaseri 
> > 
> > I think Font ends are moving away from this approach as others can see 
> > your supplied
> > passwd by a simple ps(1) command.

> Unfortunately this does *not* work with psql because for some strange reason
> psql does not read the password from stdin.

You can always use PGPASSWORD.  And for those of you that find that
envvar insecure or cumbersome, there's a new ~/.pgpass where you can
store passwords in 7.3.

-- 
Alvaro Herrera ()
Y dijo Dios: "Que sea Satanás, para que la gente no me culpe de todo a mí."
"Y que hayan abogados, para que la gente no culpe de todo a Satanás"

Re: supplying password to psql on command line?

От:
Bruce Momjian <pgman@candle.pha.pa.us>
Дата:
Christoph Dalitz wrote:
> 
> > Date: Mon, 28 Oct 2002 10:56:32 -0800
> > From: Medi Montaseri 
> > 
> > I think Font ends are moving away from this approach as others can see 
> > your supplied
> > passwd by a simple ps(1) command.
> >
> There used to be a program "hide.c" available from the oracle website,
> which made this impossible. Unfortunately I can no longer find it.
> 
> A simpler approach however is to supply the password from stdin.
> With Oracle's sqlplus this works as follows:
> 
> 	#!/bin/sh
> 
> 	sqlplus < 	userid/password@tnasalias
> 	/* SQL commands */
> 	EOF
> 
> Unfortunately this does *not* work with psql because for some strange reason
> psql does not read the password from stdin.

psql will read the password from stdin if there is no controlling
terminal on /dev/tty.

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