From: Bruce Momjian <pgman@candle.pha.pa.us>
To: Hal Lynch <hal@cc.usu.edu>
Cc: pgsql-admin <pgsql-admin@postgresql.org>
Subject: Re: Authentication in batch processing
Date: Sun, 2 Jun 2002 16:22:08 -0400 (EDT)
Message-ID: <200206022022.g52KM8m18308@candle.pha.pa.us> (raw)
In-Reply-To: <5AAA28B2-5DEA-11D6-8644-0050E490FD5B@cc.usu.edu>
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@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-admin@postgresql.org
Cc: pgman@candle.pha.pa.us, hal@cc.usu.edu
Subject: Re: Authentication in batch processing
In-Reply-To: <200206022022.g52KM8m18308@candle.pha.pa.us>
References: <5AAA28B2-5DEA-11D6-8644-0050E490FD5B@cc.usu.edu> <200206022022.g52KM8m18308@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
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