agora inbox for pgsql-admin@postgresql.org  
help / color / mirror / Atom feed
From: Erik Wienhold <ewie@ewie.name>
To: Edwin UY <edwin.uy@gmail.com>
Cc: pgsql-admin@lists.postgresql.org
Subject: Re: psql - prompt for password
Date: Thu, 30 May 2024 13:01:54 +0200
Message-ID: <822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name> (raw)
In-Reply-To: <CA+wokJ-d3c5UgGPuniwf_LLbgUMTfBJcBDQOnP0HGvzvD8CL1g@mail.gmail.com>
References: <CA+wokJ-d3c5UgGPuniwf_LLbgUMTfBJcBDQOnP0HGvzvD8CL1g@mail.gmail.com>

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





view thread (4+ messages)

Message-ID: <822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name>
Permalink:  ../822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name/
Also on:    postgresql.org/message-id/822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-admin@postgresql.org
  Cc: ewie@ewie.name, edwin.uy@gmail.com, pgsql-admin@lists.postgresql.org
  Subject: Re: psql - prompt for password
  In-Reply-To: <822d3df1-9ec9-4cbb-922a-c7ac0cff424d@ewie.name>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox