Re: Authentication in batch processing

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: Hal Lynch <hal(at)cc(dot)usu(dot)edu>
Cc: pgsql-admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Authentication in batch processing
Date: 2002-06-02 20:22:08
Message-ID: 200206022022.g52KM8m18308@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin


Password prompting was changed in 7.2.X. You can now pass a script into
psql, and you will be prompted for the password on your terminal rather
than having the password coming from the script.

The best way send the password in 7.2.X is to use 'expect', or use the
PGPASSWORD environment variable. (However, on some OS's, environment
values like PGPASSWORD can be seen by 'ps'.) Another option is that if
/dev/tty can't get opened, the password will be requested from stdin.
Unfortunately, I can't think of an easy way to make /dev/tty fail.

---------------------------------------------------------------------------

Hal Lynch wrote:
> I have postgres set up to require usernames and passwords for access.
>
> The following script works just fine in 7.1.2 without manual
> intervention. Using 7.2.1 psql issues a password prompt and
> blocks until a password is manually entered.
>
> #######################################
> #!/bin/sh
>
> psql mydb <<\__EOD__
> mypassword
> create table mytable
> (
> ssn char(9),
> name char(50)
> );
> __EOD__
> #######################################
>
> For several years now I have been using scripts like the above
> to drop and create 14 databases, and create and populate ~100
> tables on a nightly basis. I need this or something like it
> to work.
>
> As always I assume I am doing dumb.
>
> Can someone help?
>
> hal
>
>
> ---------------------------(end of broadcast)---------------------------
> TIP 5: Have you checked our extensive FAQ?
>
> http://www.postgresql.org/users-lounge/docs/faq.html
>

--
Bruce Momjian | http://candle.pha.pa.us
pgman(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruce Momjian 2002-06-03 01:06:18 Re: configure datatype name > 31?
Previous Message Stephan Szabo 2002-05-31 17:02:17 Re: LIKE operator and indexes