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 1tnj6U-0015S5-UB for pgsql-general@arkaria.postgresql.org; Thu, 27 Feb 2025 18:59:27 +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 1tnj5X-003346-DN for pgsql-general@arkaria.postgresql.org; Thu, 27 Feb 2025 18:58:26 +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 1tnj5X-00330X-23 for pgsql-general@lists.postgresql.org; Thu, 27 Feb 2025 18:58:25 +0000 Received: from mail-il1-x129.google.com ([2607:f8b0:4864:20::129]) by magus.postgresql.org with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.96) (envelope-from ) id 1tnj5R-0002AI-2O for pgsql-general@postgresql.org; Thu, 27 Feb 2025 18:58:25 +0000 Received: by mail-il1-x129.google.com with SMTP id e9e14a558f8ab-3cfcf8b7455so11392355ab.3 for ; Thu, 27 Feb 2025 10:58:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1740682701; x=1741287501; darn=postgresql.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=GL2DxWHBiWwi75LRHGaez3xmDZN2Uw7tSMjzG0fxuMY=; b=E8BPF+C03U+gTJAo1f7QGHO0NBMJIPkNlqfic1zZNflpgbDfvqQxGp6fl4XSuLnIcL 5nEg9bCncE0n0xwqPdiQsSk4mBxTcYA7OkmL6Z7M3VOB9o3CoA66cl9V+ZMzJvwrcEeG vIVc9O47P37MgwMivaD6+tS2WLHYFmPOch/K0kdRbnGilo0cJCUyGbgwWIFdANFsUNnk cCrJW0nwXDXOWvFwzgq+gRgoPa0zxPzhVM7+cFuuctik34ScsXgu8JPYV0DzEqtXOJT3 Xw2E/yv2r+rPwn7B7OErV2WX4OeIuhAzThddtTzAE7Zb8/GxqAet0DfuJLlxKeHZfuZK zV5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1740682701; x=1741287501; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=GL2DxWHBiWwi75LRHGaez3xmDZN2Uw7tSMjzG0fxuMY=; b=ZaLfdzgIatDMBuuu7t+IQFQRQOxSfU0IvEVJsHr/kPxLRdpxWUGT2iqTlagurSN70K XB4+JnKgZP0LfjCoTgl3AF27sGKOKw94CXzDPA6JOggaGI5gPc5N5EvKl6ara5v47GQ7 1gDXdZfjU5PD8y84GPU3xLG/2LJY+6mxN1OwMXEI3heleJ2ALD2CFsEc19rRNnPBsG4g Tefe0glMEqQDDLgZQWKsR6MhRszKD4RGIsweKWFZVAXdhXUadUbRyUIT9EiAkKvkJCbF cD/IPWmWniwUc/6Go3FJehwsAWVfpFF/WGEaTMzYC3cIdnfa+gXsnYX+OK7MhY8QZsH6 KrDg== X-Forwarded-Encrypted: i=1; AJvYcCXKseiYbUoxlSAxXrgOjmOqpVWRQ7OYKIqzDvWwQD04wlbrwzG54NqT6kach1+BDFlrFXKDLhvdATEp0RaC@postgresql.org X-Gm-Message-State: AOJu0YyAjjLcCPn1UDPbUeikh/IEpNi0S4MlclddlVZPe3YQZPqNKflC Bm5Tpt2/q3JVpjZpsYo8JdPLQVWmZfE+YeFrtZRYipPUi0FmXgItgLNqOW4aHRbLZ8LtQg3A3Ej 4AUvz54IGrhCBgp4lrutEfvZS2QI= X-Gm-Gg: ASbGncuvwHcVqiZi64o31IV1B+xAAcODz3b73HYhA9mFhineJoaHN70l2d1okDPkV6c OS0mAzJL24jfrel/zIMHMrOxGF6gXV2WeApG2ibeZopKFr+BJvY/jAffe88PvDsqaBumAZgEA4v GItEUjnlWEvwTZVFbR+ZhJmjoJ08Yz1x5Nz1j0hDD9wg== X-Google-Smtp-Source: AGHT+IGPdRrT4AIRs/Hi2f87apLV5xocC08dAC8SA6OPlHXC9sIWbzQshddXwj3o2x6IMlR152Viq2VGs+pLzg2Q17Q= X-Received: by 2002:a05:6e02:b2d:b0:3d1:a75e:65f6 with SMTP id e9e14a558f8ab-3d3e6f4eb55mr5916575ab.18.1740682701105; Thu, 27 Feb 2025 10:58:21 -0800 (PST) MIME-Version: 1.0 References: <056ebaa8-94bb-461d-905c-4035eab9ceac@aklaver.com> <2602739.1740681158@sss.pgh.pa.us> In-Reply-To: <2602739.1740681158@sss.pgh.pa.us> From: Greg Sabino Mullane Date: Thu, 27 Feb 2025 13:57:43 -0500 X-Gm-Features: AQ5f1JpIZWwVfZR8ldlEd_5XuTnav0hb-Je972Wa_jfc9vhQgmMc92kq0GIQmbQ Message-ID: Subject: Re: How to debug: password authentication failed for user To: Tom Lane Cc: Adrian Klaver , Alexander Farber , pgsql-general Content-Type: multipart/alternative; boundary="00000000000010f356062f2446e0" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --00000000000010f356062f2446e0 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable On Thu, Feb 27, 2025 at 1:32=E2=80=AFPM 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 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 --00000000000010f356062f2446e0 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Thu, Feb 27, 2025 at 1:32=E2=80=AFPM T= om Lane <tgl@sss.pgh.pa.us> = wrote:
> -c 'ALTER USER timeshift_user = PASSWORD '"'"'timeshift_pass'"'"= 9;;'
> 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 tha= t, but who knows what shell the OP has. It's basically trying to stop t= he current ALTER USER statement, add a new single quote (but wrap it in dou= ble 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 'timesh= ift_pass' so it's hard to see what the problem=C2=A0is.
<= br>
The fact that a manual ALTER ROLE cleared it up certainly sug= gests that something is going=C2=A0wrong, however, and the SELECT rolpasswo= rd=C2=A0output definitely means it had some password. A possibility is that= somehow the user password was already set and this particular statement wa= s not run (or run on a different cluster).

Another= debug technique might be to have the shell script write the ALTER=C2=A0USE= R command to a temp file, then slurp it in via psql -f. Then you can cat th= at file as part of the script's output

Cheers,=
Greg

--
Crunchy Data - https://www.crunchydata.com<= /div>
Enterprise Postgres Software Products & Tech Support

--00000000000010f356062f2446e0--