Re: BUG #5921: pg_dump asks for password - Mailing list pgsql-bugs

From Josh Kupershmidt
Subject Re: BUG #5921: pg_dump asks for password
Date
Msg-id AANLkTiknuQOMERFnw84MmhLQyZ3GqUOb7yxTBPd3tDXA@mail.gmail.com
Whole thread Raw
In response to BUG #5921: pg_dump asks for password  ("sandyt" <sandy@mcw.co.il>)
List pgsql-bugs
On Wed, Mar 9, 2011 at 9:04 AM, sandyt <sandy@mcw.co.il> wrote:
>
> The following bug has been logged online:
>
> Bug reference: =A0 =A0 =A05921
> Logged by: =A0 =A0 =A0 =A0 =A0sandyt
> Email address: =A0 =A0 =A0sandy@mcw.co.il
> PostgreSQL version: 8.3.8
> Operating system: =A0 windows 2008 server (64 bit)
> Description: =A0 =A0 =A0 =A0pg_dump asks for password
> Details:
>
> We want to be able to run a nightly backup using the pg_dump command.
>
> Unfortunately, even with the pg_hba.conf fix of adding host postgres =85
> trust,
>
> It still asks for a password.
>
>
>
> 1. Is this a 64bit issue? If the server was 32bit, would it not ask for a
> password?

This shouldn't matter.

> 2. Is there a way of running a dos script that would run the pg_dump
> providing a password when prompted?

Yup, if you set up trust authentication in your pg_hba.conf file
correctly. Or you can also create a ".pgpass" file from which psql can
load its password automatically, see:
  http://www.postgresql.org/docs/9.0/static/libpq-pgpass.html

> 3. Is there a way of running the pg_dump with a user that doesn't have a
> password?

To recap, you can either create the .pgpass file mentioned above, or
you can fix your pg_hba.conf file to trust local connections (or
connections from whatever machine you're connecting from). Here are
some common pitfalls I can think of that you might want to double
check
 * did you remember to use "pg_ctl ... reload" or some other means to
notify Postgres that you've changed its pg_hba.conf file?
 * maybe you're connecting to Postgres from a different address than
you specified in the Address field of pg_hba.conf? Set log_connections
=3D on  in your postgresql.conf and run pg_ctl ... reload to have
Postgres print what address it actually sees your connections coming
from in its log.
 * If you are using psql to connect to a Postgres server on the same
machine, and you would like to trust all users on that machine to
login to Postgres as a superuser, your pg_hba.conf should have lines
like this:

# "local" is for Unix domain socket connections only
local   all             all                                     trust
# IPv4 local connections:
host    all             all             127.0.0.1/32            trust
# IPv6 local connections:
host    all             all             ::1/128                 trust

If you're still having trouble, post the uncommented lines from your
pg_hba.conf file, and also post lines about connection attempts from
your PostgreSQL server log file after you've turned on
log_connections.

Josh

pgsql-bugs by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: BUG #5707: Cross compilation for windows is broken
Next
From: "Luke Gilbert"
Date:
Subject: BUG #5922: Add-on installation error.