Re: How to debug: password authentication failed for user - Mailing list pgsql-general

From Tom Lane
Subject Re: How to debug: password authentication failed for user
Date
Msg-id 2602739.1740681158@sss.pgh.pa.us
Whole thread Raw
In response to Re: How to debug: password authentication failed for user  (Adrian Klaver <adrian.klaver@aklaver.com>)
Responses Re: How to debug: password authentication failed for user
List pgsql-general
Adrian Klaver <adrian.klaver@aklaver.com> writes:
> My guess it has to do with:
> -c 'ALTER USER timeshift_user PASSWORD '"'"'timeshift_pass'"'"';'
> I am still trying to work out what that quoting is doing?

That makes my head hurt, too.  Using log_statement to see what's
actually getting sent to the server, I can see that as given
it looks to be fine --- but if you put a shell variable in for
the password as per the original intention, it's not expanded.
I think what you need is

 -c 'ALTER USER timeshift_user PASSWORD '"'$PASSWORD'"';'

Note this will fall over with potential for SQL injection if there's a
single quote in the password, so better not use it with untrusted
input.  On the whole I'd say "find some other way to do that".

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: How to debug: password authentication failed for user
Next
From: Greg Sabino Mullane
Date:
Subject: Re: How to debug: password authentication failed for user