pg.ddx.io  pgsql-general@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Martín Marqués <martin@2ndquadrant.com>
To: rod@iol.ie
To: Ricardo Martin Gomez <rimartingomez@hotmail.com>
To: James Keener <jim@jimkeener.com>
To: David Gauthier <davegauthierpg@gmail.com>
Cc: pgsql-generallists.postgresql.org <pgsql-general@lists.postgresql.org>
Subject: Re: hardcode password in connect string
Date: Sun, 15 Apr 2018 17:10:04 -0300
Message-ID: <4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com> (raw)
In-Reply-To: <e0fef727-a920-a929-be64-9519eb07ece7@iol.ie>
References: <CAMBRECAUBdTe6fFWynyj6NE2yURNg+sLsra2RL4gh2j5FwZ0Og@mail.gmail.com>
	<CC538BE6-170C-46C8-B79D-93BADDA8E3CB@jimkeener.com>
	<CAMBRECBBvug_ZZKAEca==S0vMTLgo1X2smkjchO=KpD=A56Rog@mail.gmail.com>
	<FR1P15201MB2296C637226598F8CAA1AF89A3B10@FR1P15201MB2296.LAMP152.PROD.OUTLOOK.COM>
	<e0fef727-a920-a929-be64-9519eb07ece7@iol.ie>

El 15/04/18 a las 12:16, Raymond O'Donnell escribió:
> On 15/04/18 12:35, Ricardo Martin Gomez wrote:
>> Hello David,
>> I think so, the parameter you need in psql command is -w mipassword.
> 
> Sorry, this is not correct. -w causes psql *never* to prompt for a
> password, and -W forces a password prompt. Neither allows the password
> to be passed as an argument - I don't think that this is possible with
> psql.

It is possible, you just have to construct the whole string:

psql "host=thehost dbname=mydatabase user=memyselfi password=mypassword"

Still, the best option, and the most secure, is to use a .pgpass file.
The psql invocation with it's password will very likely end in
.bash_history and alike.

Regards,

-- 
Martín Marqués                http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Training & Services




view thread (8+ messages)

Message-ID: <4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com>
Permalink:  ../4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com/
Also on:    postgresql.org/message-id/4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com

 · 

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 from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-general@postgresql.org
  Cc: martin@2ndquadrant.com, rod@iol.ie, rimartingomez@hotmail.com, jim@jimkeener.com, davegauthierpg@gmail.com
  Subject: Re: hardcode password in connect string
  In-Reply-To: <4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com>
  References: <CAMBRECAUBdTe6fFWynyj6NE2yURNg+sLsra2RL4gh2j5FwZ0Og@mail.gmail.com> <CC538BE6-170C-46C8-B79D-93BADDA8E3CB@jimkeener.com> <CAMBRECBBvug_ZZKAEca==S0vMTLgo1X2smkjchO=KpD=A56Rog@mail.gmail.com> <FR1P15201MB2296C637226598F8CAA1AF89A3B10@FR1P15201MB2296.LAMP152.PROD.OUTLOOK.COM> <e0fef727-a920-a929-be64-9519eb07ece7@iol.ie> <4ee7b3cf-bb0d-2131-d37e-ec8f547d0234@2ndquadrant.com>

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

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