Re: Why pg_dump 'trust' authentication fails under root and works under another user?

From: Simon <simon(at)apricotwebsolutions(dot)com>
To: Postgres Admin <pgsql-admin(at)postgresql(dot)org>
Subject: Re: Why pg_dump 'trust' authentication fails under root and works under another user?
Date: 2011-03-24 07:49:51
Message-ID: AANLkTi=8gD=oNWQhO7-Y9-iNzzOyuR0Ut6N+pqfpg=wc@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

I don't know why postgres is prompting for a password. But you could try
putting the following in your crontab:

su postgres -c 'pg_dump ...'

Simon

2011/3/24 Jaroslav Záruba <jaroslav(dot)zaruba(at)gmail(dot)com>

> Hello
>
> I have pg_dump command in cron that accesses PostgreSQL under user postgres
> and does not provide a password.
>
> pg_dump --username=postgres ...
>
> I have set in pg_hba.conf that user postgres should be trusted for all
> databases from localhost.
>
> local all postgres trust
>
> When I run the command under regular user it works.
> When I run it under root (sudo -i) it requires password, and therefore the
> crontab task fails to authenticate.
>
> (I'm looking at both users' 'export' command output, and there seems to be
> nothing related to PostgreSQL.)
>
> Could someone explain to me what is happening here?
>
> Regards
> J. Záruba

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Guillaume Lelarge 2011-03-24 08:03:07 Re: Why pg_dump 'trust' authentication fails under root and works under another user?
Previous Message Jaroslav Záruba 2011-03-24 07:34:28 Why pg_dump 'trust' authentication fails under root and works under another user?