Re: send password to pg_dump

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: shaunc <shaun(at)cranedata(dot)us>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: send password to pg_dump
Date: 2007-01-22 22:34:07
Message-ID: 45B53BDF.1030909@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

shaunc wrote:
> Hello,
>
> I'm trying to run pg_dump programmatically, and I'm wondering how I can send
> it a password.
>
> I'm running it with a system() call in a child process, and sending the
> password in from the parent process on stdin, but somehow pg_dump always
> finds out how to ask my terminal for a password. How do I fool it?
>
> (I need this to work in linux... in python would be preferable too.)
>
>
>

1. this is the wrong forum for this question - here we discuss
postgresql developments, not usage
2. use a pgpass file, possibly with a PGPASSFILE environment setting as
well - see the docs for details. This works on all platforms and should
work with anything at all calling pg_dump.
3. In general, the only way to "fool" programs properly this way is to
use expect or some equivalent that uses ptys. In this case, it would be
overkill.

cheers

andrew

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim C. Nasby 2007-01-22 22:49:46 Re: Piggybacking vacuum I/O
Previous Message Oleg Bartunov 2007-01-22 22:25:24 Re: 10 weeks to feature freeze (Pending Work)