Re: hardcode password in connect string

From: Ricardo Martin Gomez <rimartingomez(at)hotmail(dot)com>
To: James Keener <jim(at)jimkeener(dot)com>, David Gauthier <davegauthierpg(at)gmail(dot)com>
Cc: pgsql-generallists(dot)postgresql(dot)org <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: hardcode password in connect string
Date: 2018-04-15 11:35:41
Message-ID: FR1P15201MB2296C637226598F8CAA1AF89A3B10@FR1P15201MB2296.LAMP152.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Hello David,
I think so, the parameter you need in psql command is -w mipassword.
But, you have to understand that use this form or set PGPASSWORD aren't safer.
Exist a file (pg_hba.conf) for this process ir task.
Regards

Obtener Outlook para Android<https://aka.ms/ghei36>

________________________________
From: David Gauthier <davegauthierpg(at)gmail(dot)com>
Sent: Friday, April 13, 2018 3:51:33 PM
To: James Keener
Cc: pgsql-generallists.postgresql.org
Subject: Re: hardcode password in connect string

PGPASSWORD env var works fine.
Thanks !

On Fri, Apr 13, 2018 at 2:46 PM, James Keener <jim(at)jimkeener(dot)com<mailto:jim(at)jimkeener(dot)com>> wrote:
Is setting it as an environment variable an option? https://www.postgresql.org/docs/9.1/static/libpq-envars.html

Alternatively, a service file? https://www.postgresql.org/docs/9.0/static/libpq-pgservice.html

Jim

On April 13, 2018 2:43:01 PM EDT, David Gauthier <davegauthierpg(at)gmail(dot)com<mailto:davegauthierpg(at)gmail(dot)com>> wrote:
Hi:

PG v9.5.2 on RHEL

I like to use an alias to connect to my favorite DBs but don't like to enter passwords. I used to just disable passwords (working behind a firewall), but this one is different. I see nothing in the interactive connect string where I can enter the password...

psql -h thehost -U memyselfi mydb

Missing something like "-p mypassword"

Is there a way I can stick the pw in the linux alias definition ?

Just thinking something like this may be available since hardcoded passwords are supported in perl/dbi, pg driver

Thanks !

--
Sent from my Android device with K-9 Mail. Please excuse my brevity.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Ricardo Martin Gomez 2018-04-15 11:43:56 Re: Can a broken Postgresql data directory be reconstructed without losing data?
Previous Message A A 2018-04-15 08:25:05 Can a broken Postgresql data directory be reconstructed without losing data?