> Lincoln Yeoh <lyeoh@pop.jaring.my> writes:
> > At 01:08 AM 11/28/01 -0500, Tom Lane wrote:
> >> ... Password auth sucks from a convenience point of view
> >> (or even from a possibility point of view, for scripts; don't forget
> >> the changes that you yourself recently applied to guarantee that a
> >> script *cannot* supply a password to psql).
>
> > Ack. We can't send in passwords to psql anymore? :(
>
> Well, Bruce, you were the one that was hot to make that /dev/tty change.
> Time to defend it.
Hey, if people want it back, it is easy to do.
My only goal was to make psql consistent with other applications that
require passwords.
> > Is there a safe way to send username and password to psql?
>
> If you want to put those things in a script, you could still do
>
> export PGUSER=whatever
> export PGPASSWORD=whatever
> psql ...
>
> This would actually work a lot better than other ways for cases such
> as doing pg_dumpall, where you'd otherwise need to supply the password
> multiple times.
What about 'ps -e' that shows all environment variables? This is in
some ways worse than piping the password into psql. At least there was
some chance that they were using 'cat' from a file with the proper
permissions. WIth PGPASSWORD, there is no way to restrict who can see
it via 'ps -e'.
Seems we shouldn't allow PGPASSWORD either.
The idea of allowing the password to be stored in a file with 600
permissions seems quite standard. CVS does this.
-- 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,
Pennsylvania19026