Why pg_dump 'trust' authentication fails under root and works under another user? - Mailing list pgsql-admin

From Jaroslav Záruba
Subject Why pg_dump 'trust' authentication fails under root and works under another user?
Date
Msg-id AANLkTikR5sO5zYYRpNOTLUS+jUdrJKUT-vPTMgm4b88=@mail.gmail.com
Whole thread Raw
Responses Re: Why pg_dump 'trust' authentication fails under root and works under another user?  (Guillaume Lelarge <guillaume@lelarge.info>)
Re: Why pg_dump 'trust' authentication fails under root and works under another user?  (Simon <simon@apricotwebsolutions.com>)
List pgsql-admin
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

pgsql-admin by date:

Previous
From: Selva manickaraja
Date:
Subject: PITR Recovery settings
Next
From: Guillaume Lelarge
Date:
Subject: Re: Why pg_dump 'trust' authentication fails under root and works under another user?