Re: psql - prompt for password

From: Erik Wienhold <ewie(at)ewie(dot)name>
To: Edwin UY <edwin(dot)uy(at)gmail(dot)com>
Cc: pgsql-admin(at)lists(dot)postgresql(dot)org
Subject: Re: psql - prompt for password
Date: 2024-05-30 11:01:54
Message-ID: 822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On 2024-05-30 10:07 +0200, Edwin UY wrote:
> Is createuser the only one I can use to create a user where it prompts for
> a password? There is no alteruser though.
> I want to use psql and \prompt but am lost on how to use it.
> Basically just want to use it for running a psql script like for example -
> ALTER USER spongebob WITH ENCRYPTED PASSWORD ':newpassword';

Or use \password which has the benefit of not leaking the plaintext
password into the logs which would be the case if there's an error in
the ALTER USER command.

psql -c '\password spongebob'

--
Erik

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Mohan NBSPS 2024-05-31 14:28:58 Re: Postgresql 9.5: Streaming Replication: Secondaries Fail To Start Post WAL Error
Previous Message Kashif Zeeshan 2024-05-30 08:17:37 Re: psql - prompt for password