postgres backup script and popen2

Jean-Paul Calderone exarkun at divmod.com
Thu Feb 8 12:25:20 EST 2007


On 8 Feb 2007 09:18:26 -0800, Gabriel Genellina <gagsl-py at yahoo.com.ar> wrote:
>On 8 feb, 13:29, Jean-Paul Calderone <exar... at divmod.com> wrote:
>> On 8 Feb 2007 08:23:49 -0800, Gabriel Genellina <gagsl... at yahoo.com.ar> wrote:
>> >On 8 feb, 10:27, Maël Benjamin Mettler <m... at mediamonger.ch> wrote:
>> >> flupke schrieb:
>> >> > i made a backup script to backup my postgres database.
>> >> > Problem is that it prompts for a password. It thought i
>> >> > could solve this by using popen2.
>>
>> >> Use pexpect:http://pexpect.sourceforge.net/
>>
>> >pexpect could work. But a better way would be to supply the password
>> >on the command line.
>>
>> So that it shows up in `ps' output to anyone on the system? :)
>
>Any solution has pros and cons...

Some solutions have more or less of these than other solutions though.

>having the password in the source code is not so good anyway...

Sure, but just because one has a password in the source doesn't mean
one should completely give up.  If you want to completely give up, you
can just disable password authentication in pgsql.  That's a lot simpler
than any other solution mentioned so far. :)

Jean-Paul



More information about the Python-list mailing list