Thread: PG_DUMP without asking password

PG_DUMP without asking password

From
"Alain Roger"
Date:
Hi,

is there a way to backup the database thanks a command script, without postgresql requesting the user password ?

thanks a lot,

Alain

Re: PG_DUMP without asking password

From
Matthias.Pitzl@izb.de
Date:
Hm, depends on how the security settings of the database are set. For local users you could set in the pg_hba.conf ident as authentication method. Then they won't need a password anymore.
See the pg_hba.conf documentation for more infos.
Another way could be to execute the dump script under a privileged user. For my machines here, the user postgres can dump all databases without entering a password.
If you backup your database via a cron job started by root, you can simply do a su postgres -c ... to run the backupjob under user postgres.
 
-- Matthias
-----Original Message-----
From: pgsql-general-owner@postgresql.org [mailto:pgsql-general-owner@postgresql.org] On Behalf Of Alain Roger
Sent: Friday, September 22, 2006 1:32 PM
To: pgsql-general@postgresql.org
Subject: [GENERAL] PG_DUMP without asking password

Hi,

is there a way to backup the database thanks a command script, without postgresql requesting the user password ?

thanks a lot,

Alain

Re: PG_DUMP without asking password

From
Terry Fielder
Date:
If you run it on the same server, with a user who has permission to
access the db using ident (e.g. user "postgres"),
i.e. you have a pg_hba.conf entry like:
local  all    postgres             ident   sameuser

Then pg_dump and pg_dumpall will not require a password.

Alternatively, you can create a .pgpass file in the users home directory
(if ident not available, but you *need* to think about the permissions
of this file and ramifications)

Terry

Terry Fielder
terry@greatgulfhomes.com
Associate Director Software Development and Deployment
Great Gulf Homes / Ashton Woods Homes
Fax: (416) 441-9085



Alain Roger wrote:
> Hi,
>
> is there a way to backup the database thanks a command script, without
> postgresql requesting the user password ?
>
> thanks a lot,
>
> Alain