Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXnEk-0002hG-C0 for pgsql-general@arkaria.postgresql.org; Thu, 21 Nov 2019 14:15:10 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.89) (envelope-from ) id 1iXnEh-00058V-Li for pgsql-general@arkaria.postgresql.org; Thu, 21 Nov 2019 14:15:07 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXnEh-00058O-Bs for pgsql-general@lists.postgresql.org; Thu, 21 Nov 2019 14:15:07 +0000 Received: from mailbackend.panix.com ([166.84.1.89]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.89) (envelope-from ) id 1iXnEe-0002lH-Nx for pgsql-general@lists.postgresql.org; Thu, 21 Nov 2019 14:15:06 +0000 Received: from panix2.panix.com (panix2.panix.com [166.84.1.2]) by mailbackend.panix.com (Postfix) with ESMTP id 47JhQt5l6Bz1MNt; Thu, 21 Nov 2019 09:15:02 -0500 (EST) Received: by panix2.panix.com (Postfix, from userid 17622) id 47JhQt4hpSz1ZVx; Thu, 21 Nov 2019 09:15:02 -0500 (EST) Date: Thu, 21 Nov 2019 09:15:02 -0500 From: stan To: Magnus Hagander Cc: pgsql-general@lists.postgresql.org Subject: Re: Help with authentication on Debain/Ubuntu installation Message-ID: <20191121141502.GA14731@panix.com> References: <20191121124517.GA3320@panix.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Editor: gVim User-Agent: Mutt/1.12.1 (2019-06-15) List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Precedence: bulk On Thu, Nov 21, 2019 at 02:05:09PM +0100, Magnus Hagander wrote: > On Thu, Nov 21, 2019 at 1:46 PM stan wrote: > > > I am trying to set up to do some work with pg_dump, and I would like to be > > able to connect from my normal user to do this. This is on a Ubunt 18.04 > > installation. I have added the follwing to pg_hba.conf: > > > > host all all 0.0.0.0/0 md5 > > hostssl all all 0.0.0.0/0 md5 > > > > But when I try to login like this: > > > > psql stan postgres -W > > > > I get the following error, and yes, I set postgres'es password to something > > I know: > > > > tan@stantest:~$ psql stan postgres -W > > Password: > > psql: error: could not connect to server: FATAL: Peer authentication > > failed for user "postgres" > > stan@stantest:~$ > > > > What am I doing wrong? > > > > > By default, Debian has a row in pg_hba.conf that enforces peer specifically > for the postgres superuser when connecting over unix sockets (which is a > very good thing from a security perspective). You will have to find that > row further up in the file and comment it out (since the first row that > matches will be used). Thanks, found it, I believe: local all postgres Good to know first match wins, that is different than some other systems I am used to. -- "They that would give up essential liberty for temporary safety deserve neither liberty nor safety." -- Benjamin Franklin