Thread: pg_dump password

pg_dump password

From
Q Beukes
Date:
Hey,

We want to close up the db so people can't alter the database, so we
thought of using
a password. The problem now is that we can't have pg_dump run because it
prompts
for a password.

Are there any alternatives for closing up the database? Having host/user
based trust
isn't really an option because it's a web application, and if the web
user can simply
access the database, it would be all to easy to install a web pg admin
package.

If not, is there a way to pass on a password to the pg_dump(all) utility?

regards,
Q Beukes

Re: pg_dump password

From
Sean Davis
Date:
On Wednesday 13 September 2006 06:59, Q Beukes wrote:
> Hey,
>
> We want to close up the db so people can't alter the database, so we
> thought of using
> a password. The problem now is that we can't have pg_dump run because it
> prompts
> for a password.

I'm not sure what you mean here?  You can just enter the password?

> Are there any alternatives for closing up the database? Having host/user
> based trust
> isn't really an option because it's a web application, and if the web
> user can simply
> access the database, it would be all to easy to install a web pg admin
> package.

You can create as many users as you like and tailor your pg_hba file to suit
your needs.  If you want to keep one user for pg_dump that uses trust-based
authentication on a single machine, go ahead.  If you want to make a web user
that can connect from anywhere but needs a password, you can create that,
also.

> If not, is there a way to pass on a password to the pg_dump(all) utility?

Simply type it in or use trust-based authentication on the database server if
you must.

Sean

Re: pg_dump password

From
Tom Lane
Date:
Q Beukes <pgsql-novice@list.za.net> writes:
> We want to close up the db so people can't alter the database, so we
> thought of using
> a password. The problem now is that we can't have pg_dump run because it
> prompts
> for a password.

Create a ~/.pgpass file for the account pg_dump runs under.
http://www.postgresql.org/docs/8.1/static/libpq-pgpass.html

            regards, tom lane

Re: pg_dump password

From
Lan Barnes
Date:
Do you mean your scripts automating the pg_dump broke? Because otherwise
entering the password is trivial.

If it is a scripting problem, expect will fix it up for you. If you're
wandering in the swamps of Microsoft, I believe there is a M$ port of
expect now.

http://expect.nist.gov/

On Wed, Sep 13, 2006 at 12:59:25PM +0200, Q Beukes wrote:
> Hey,
>
> We want to close up the db so people can't alter the database, so we
> thought of using
> a password. The problem now is that we can't have pg_dump run because it
> prompts
> for a password.
>
> Are there any alternatives for closing up the database? Having host/user
> based trust
> isn't really an option because it's a web application, and if the web
> user can simply
> access the database, it would be all to easy to install a web pg admin
> package.
>
> If not, is there a way to pass on a password to the pg_dump(all) utility?
>
> regards,
> Q Beukes
>
> ---------------------------(end of broadcast)---------------------------
> TIP 6: explain analyze is your friend

--
Lan Barnes
Linux Guy, SCM Specialist
Tcl/Tk Enthusiast

The problem with OO code is really that you have to make a lot of it
before you can test it.
                              - Donal K. Fellows