Thread: pg_dump and password required

pg_dump and password required

From
Sergey Litvinenko
Date:
Hello!

I have Postgres configured so it requires password to access DB (in
pg_hba.conf).

The problem is that I want to set up an automated backup with pg_dump, but it
asks for password interactively, rather then accept password from either
command-line option or from some config-file (e.g. ~/.psqlrc)

The workaround would be to disable password requirement, but this is a
security risk I want to avoid.

Why no to add an option --password="" to command-line options of pg_dump?

--
Sincerely,
Sergey Litvinenko
-----------------
sergey@rsu.ru
icq#: 34161555
http://www.rsu.ru/~sergey/

Re: pg_dump and password required

From
Devrim GÜNDÜZ
Date:
Hi,

On Mon, 2007-10-15 at 01:05 +0400, Sergey Litvinenko wrote:
> The problem is that I want to set up an automated backup with pg_dump,
> but it  asks for password interactively, rather then accept password
> from either command-line option or from some config-file (e.g.
> ~/.psqlrc)

http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html


> The workaround would be to disable password requirement, but this is a
> security risk I want to avoid.
>
> Why no to add an option --password="" to command-line options of
> pg_dump?

This is a worse security risk, IMHO.
--
Devrim GÜNDÜZ
PostgreSQL Replication, Consulting, Custom Development, 24x7 support
Managed Services, Shared and Dedicated Hosting
Co-Authors: plPHP, ODBCng - http://www.commandprompt.com/