Received: from maia.hub.org (maia-2.hub.org [200.46.204.251]) by mail.postgresql.org (Postfix) with ESMTP id 3F4B0133616B for ; Thu, 24 Mar 2011 07:37:22 -0300 (ADT) Received: from mail.postgresql.org ([200.46.204.86]) by maia.hub.org (mx1.hub.org [200.46.204.251]) (amavisd-maia, port 10024) with ESMTP id 27722-06 for ; Thu, 24 Mar 2011 10:36:41 +0000 (UTC) X-Greylist: delayed 00:44:28.323323 by SQLgrey-1.7.6 Received: from miranda.sommitrealweird.co.uk (miranda.sommitrealweird.co.uk [195.10.223.140]) by mail.postgresql.org (Postfix) with ESMTP id 820391337B67 for ; Thu, 24 Mar 2011 07:36:41 -0300 (ADT) Received: from [2001:470:90fc:0:7025:9fff:fee3:9812] (helo=erwin.sommitrealweird.co.uk) by miranda.sommitrealweird.co.uk with esmtpsa (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.72) (envelope-from ) id 1Q2hD9-0005Z0-KM for pgsql-admin@postgresql.org; Thu, 24 Mar 2011 09:52:11 +0000 Received: from brettp by erwin.sommitrealweird.co.uk with local (Exim 4.72) (envelope-from ) id 1Q2hD9-00056N-Mi for pgsql-admin@postgresql.org; Thu, 24 Mar 2011 09:52:11 +0000 Date: Thu, 24 Mar 2011 09:52:11 +0000 From: Brett Parker To: pgsql-admin@postgresql.org Subject: Re: Why pg_dump 'trust' authentication fails under root and works under another user? Message-ID: <20110324095211.GB5521@sommitrealweird.co.uk> References: <4D8AFABB.1010002@lelarge.info> <4D8B0758.8020707@lelarge.info> <4D8B0E9B.9050206@lelarge.info> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.20 (2009-06-14) X-Virus-Scanned: Maia Mailguard 1.0.1 X-Spam-Status: No, hits=-1.91 tagged_above=-10 required=5 tests=BAYES_00=-1.9, T_RP_MATCHES_RCVD=-0.01 X-Spam-Level: X-Archive-Number: 201103/230 X-Sequence-Number: 37102 On 24 Mar 10:39, Jaroslav Záruba wrote: > The command line is still the same, when executed under one user it does not > ask for password, when executed under another (root that is) it does: > pg_dump --ignore-version --host=localhost --port=5432 --username=postgres > --file="$BACKUP_FILE" --format=p --column-inserts --encoding=UTF-8 db123 If you *really* want root to be able to login to the database as the postgres user using ident authentication, then you're going to need to add a line to pg_hba.conf using an ident map, then in the ident map you're going to have to allow root to map to postgres. root, per default, does not have a user in postgres. Run your script as the postgres user if you *really* want super user access. Thanks, -- Brett Parker http://www.sommitrealweird.co.uk/ PGP Fingerprint 1A9E C066 EDEE 6746 36CB BD7F 479E C24F 95C7 1D61