Re: pg_dump backup problems with password authentication - Mailing list pgsql-admin

From Richard Poole
Subject Re: pg_dump backup problems with password authentication
Date
Msg-id 20001207142141.B29301@office.vi.net
Whole thread Raw
In response to pg_dump backup problems with password authentication  (Ricardo Dias Marques <ricmarques@spamcop.net>)
List pgsql-admin
On Thu, Dec 07, 2000 at 01:07:17PM +0000, Ricardo Dias Marques wrote:

> So, I did a man pg_dump and found out that -u would prompt
> for username and password, and -v would give a verbose output.
> And so I did:
> pg_dump -u -v dbname > dbname.pgdump
>
>
> The problem is when I press the ENTER key on that command:
> it just sits there! Eventually, I have to hit CTRL+C to get out.
>
>
> Can any kind soul explain me what I am doing wrong?  :(

Unfortunately, the prompts for your username and password come out
on standard output, which you're redirecting to the file. So you
don't see them. But pg_dump is listening; type in your username and
password as if you *had* seen the prompts and it will all work.
Alternatively, you can use "echo" to give them:

echo -n -e "username\npassword\n" | pg_dump -u -v dbname > dbname.pgdump

This is insecure, as your password is briefly visible in a full ps output,
but it works non-interactively, so you can do it in scripts (e.g., from
cron). Of course, that's potentially even more insecure...

Richard

pgsql-admin by date:

Previous
From: Ricardo Dias Marques
Date:
Subject: pg_dump backup problems with password authentication
Next
From: Ricardo Dias Marques
Date:
Subject: Re: pg_dump backup problems with password authentication