Skip site navigation (1) Skip section navigation (2)

Re: supplying password to psql on command line?

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Christoph Dalitz <christoph(dot)dalitz(at)hs-niederrhein(dot)de>
Cc: medi(dot)montaseri(at)intransa(dot)com, pgsql-general(at)postgresql(dot)org,stan(at)morgan(dot)harvard(dot)edu
Subject: Re: supplying password to psql on command line?
Date: 2002-10-29 18:08:19
Message-ID: 200210291808.g9TI8JR09845@candle.pha.pa.us (view raw or flat)
Thread:
Lists: pgsql-general
Christoph Dalitz wrote:
> 
> > Date: Mon, 28 Oct 2002 10:56:32 -0800
> > From: Medi Montaseri <medi(dot)montaseri(at)intransa(dot)com>
> > 
> > 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 <<EOF
> 	userid/password(at)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(at)candle(dot)pha(dot)pa(dot)us               |  (610) 359-1001
  +  If your life is a hard drive,     |  13 Roberts Road
  +  Christ can be your backup.        |  Newtown Square, Pennsylvania 19073

In response to

pgsql-general by date

Next:From: Bruce MomjianDate: 2002-10-29 18:11:40
Subject: Re: DAFS?
Previous:From: Kevin OldDate: 2002-10-29 17:53:09
Subject: Stream data into Postgres via Perl

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group