Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tnl7G-001gyT-6y for pgsql-general@arkaria.postgresql.org; Thu, 27 Feb 2025 21:08:23 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.94.2) (envelope-from ) id 1tnl7H-005V3o-9g for pgsql-general@arkaria.postgresql.org; Thu, 27 Feb 2025 21:08:21 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1tnl6S-005Qdv-3d for pgsql-general@lists.postgresql.org; Thu, 27 Feb 2025 21:07:31 +0000 Received: from fhigh-b8-smtp.messagingengine.com ([202.12.124.159]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.96) (envelope-from ) id 1tnl6K-00033X-3D for pgsql-general@postgresql.org; Thu, 27 Feb 2025 21:07:30 +0000 Received: from phl-compute-12.internal (phl-compute-12.phl.internal [10.202.2.52]) by mailfhigh.stl.internal (Postfix) with ESMTP id DE3142540130; Thu, 27 Feb 2025 16:07:23 -0500 (EST) Received: from phl-mailfrontend-02 ([10.202.2.163]) by phl-compute-12.internal (MEProxy); Thu, 27 Feb 2025 16:07:24 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aklaver.com; h= cc:cc:content-transfer-encoding:content-type:content-type:date :date:from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to; s=fm3; t=1740690443; x=1740776843; bh=pkEN3S+A//nZYkDZILCrxGl8CLtJhbCG7NJgVKXHngo=; b= juCWJDRVCET2sDKq25P5itI/6+6XnjIktqTxVUn3HNli1/PqJwbcuUbpKkjNFfoY S78ruYhfYasZvHZi/koFTV3Eojd3ANGbAtpMpGsiEronuiT0+WAHXhiennu1HEjW XVCKRcsLCgyS9r2sqk4LYkhqrjqmltjuUnNDhmkxnpoJ2ldT6dPfO+jhsVwN5oUX fW9p6MCDmiu/aUrBfSurS+M46L7NMTB0d/mCwk9bLdHnjX3/uyFTZ6DyIcZUQyQ5 lCeNfMFSxXv+BALmsKcG0TdktK4Zwki3iL4ifg/XTZMnfZzARw/IHxTaLF9pHASJ CLsXDMYrexYbCS67RS7c1Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:cc:content-transfer-encoding :content-type:content-type:date:date:feedback-id:feedback-id :from:from:in-reply-to:in-reply-to:message-id:mime-version :references:reply-to:subject:subject:to:to:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; t=1740690443; x= 1740776843; bh=pkEN3S+A//nZYkDZILCrxGl8CLtJhbCG7NJgVKXHngo=; b=j WrWzHtw5zYMW3kr3O+r2HHtbvNaQs0GzKWJBpne2/R/Q8HeRWs8Zb6GEOIpLS9g9 NZLpY83wx7QGGzMIEibJ4JvhETHvFgwl2uxbXKjy3lY3T1xhP4+6EjPY4rR7DtIQ Z5qK+afgCyfRCAPFdD0zIm8zNAaXeQdTOer8Ca6VTFRNq5ahWqvX6pNUJtTQaw3w hE+5CTDEZEmVRbYznRy4rPOHU52rM5kdMD0LAh/6R2G9LQX0+nD4ehqKXhOR8MjH rPhLukV8NlEF6dn1mQGRAkIEneVducpnlCh0KO7qhc6SzOqVxXK8M/9z0RAym/f/ 6QEjk1+wNrJFacCZpr9kw== X-ME-Sender: X-ME-Received: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeefvddrtddtgdekkeehtdcutefuodetggdotefrod ftvfcurfhrohhfihhlvgemucfhrghsthforghilhdpggftfghnshhusghstghrihgsvgdp uffrtefokffrpgfnqfghnecuuegrihhlohhuthemuceftddtnecusecvtfgvtghiphhivg hnthhsucdlqddutddtmdenucfjughrpefkffggfgfuvfevfhfhjggtgfesthekredttddv jeenucfhrhhomheptegurhhirghnucfmlhgrvhgvrhcuoegrughrihgrnhdrkhhlrghvvg hrsegrkhhlrghvvghrrdgtohhmqeenucggtffrrghtthgvrhhnpeefhedtvedvgfekgfdt ieejjeegudfhveeuvdfhffetfeeufeduieevgeekveeiffenucffohhmrghinheptghruh hntghhhigurghtrgdrtghomhenucevlhhushhtvghrufhiiigvpedtnecurfgrrhgrmhep mhgrihhlfhhrohhmpegrughrihgrnhdrkhhlrghvvghrsegrkhhlrghvvghrrdgtohhmpd hnsggprhgtphhtthhopeegpdhmohguvgepshhmthhpohhuthdprhgtphhtthhopehhthgr mhhfihgushesghhmrghilhdrtghomhdprhgtphhtthhopehtghhlsehsshhsrdhpghhhrd hprgdruhhspdhrtghpthhtoheprghlvgigrghnuggvrhdrfhgrrhgsvghrsehgmhgrihhl rdgtohhmpdhrtghpthhtohepphhgshhqlhdqghgvnhgvrhgrlhesphhoshhtghhrvghsqh hlrdhorhhg X-ME-Proxy: Feedback-ID: i76984098:Fastmail Received: by mail.messagingengine.com (Postfix) with ESMTPA; Thu, 27 Feb 2025 16:07:22 -0500 (EST) Message-ID: <49036afe-bfc0-48fc-9cef-971397efb426@aklaver.com> Date: Thu, 27 Feb 2025 13:07:22 -0800 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: How to debug: password authentication failed for user To: Greg Sabino Mullane , Tom Lane Cc: Alexander Farber , pgsql-general References: <056ebaa8-94bb-461d-905c-4035eab9ceac@aklaver.com> <2602739.1740681158@sss.pgh.pa.us> Content-Language: en-US From: Adrian Klaver In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2/27/25 10:57, Greg Sabino Mullane wrote: > On Thu, Feb 27, 2025 at 1:32 PM Tom Lane > wrote: > > > -c 'ALTER USER timeshift_user PASSWORD '"'"'timeshift_pass'"'"';' > > I am still trying to work out what that quoting is doing? > > > That's standard for -x output for some versions of bash. FWIW, none of > the shells I had access to output it quite like that, but who knows what > shell the OP has. It's basically trying to stop the current ALTER USER I have to believe it is is related to this sequence: docker build -f ./Dockerfile --build-arg PGPASSWORD=timeshift_pass [...] ARG PGPASSWORD ENV POSTGRES_PASSWORD=$PGPASSWORD [...] ENV PGUSER=timeshift_user ENV PGPASSWORD=$PGPASSWORD [...] RUN chmod +x ./01-create-database.sh ./04-alter-owner.sh Where /01-create-database.sh has: echo "Setting password for $PGUSER to $PGPASSWORD" psql --username=postgres --dbname=postgres -c "ALTER USER $PGUSER PASSWORD '$PGPASSWORD';" I just don't know enough about Docker to really understand all the hoops that are being jumped through in the above. > statement, add a new single quote (but wrap it in double quotes!), then > start a new single-quoted string (the actual password). (So single, > double-single-double, single). Then do it all again at the end. It's > valid, and it should really be equivalent to PASSWORD 'timeshift_pass' > so it's hard to see what the problem is. > > The fact that a manual ALTER ROLE cleared it up certainly suggests that > something is going wrong, however, and the SELECT rolpassword output > definitely means it had some password. A possibility is that somehow the > user password was already set and this particular statement was not run > (or run on a different cluster). > > Another debug technique might be to have the shell script write the > ALTER USER command to a temp file, then slurp it in via psql -f. Then > you can cat that file as part of the script's output > > Cheers, > Greg > > -- > Crunchy Data - https://www.crunchydata.com > Enterprise Postgres Software Products & Tech Support > -- Adrian Klaver adrian.klaver@aklaver.com