Re: BUG #5921: pg_dump asks for password

From: Josh Kupershmidt <schmiddy(at)gmail(dot)com>
To: sandyt <sandy(at)mcw(dot)co(dot)il>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #5921: pg_dump asks for password
Date: 2011-03-10 04:01:16
Message-ID: AANLkTiknuQOMERFnw84MmhLQyZ3GqUOb7yxTBPd3tDXA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

On Wed, Mar 9, 2011 at 9:04 AM, sandyt <sandy(at)mcw(dot)co(dot)il> wrote:
>
> The following bug has been logged online:
>
> Bug reference:      5921
> Logged by:          sandyt
> Email address:      sandy(at)mcw(dot)co(dot)il
> PostgreSQL version: 8.3.8
> Operating system:   windows 2008 server (64 bit)
> Description:        pg_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 …
> 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
= 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

In response to

Browse pgsql-bugs by date

  From Date Subject
Next Message charles johnson 2011-03-10 04:08:41 BUG #5923: Build problem
Previous Message Bruce Momjian 2011-03-10 03:49:16 Re: BUG #5707: Cross compilation for windows is broken