pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Passing password in psql command
4+ messages / 4 participants
[nested] [flat]

* Passing password in psql command
@ 2015-03-02 09:27  Technical Doubts <online.technicaldoubts@gmail.com>
  0 siblings, 2 replies; 4+ messages in thread

From: Technical Doubts @ 2015-03-02 09:27 UTC (permalink / raw)
  To: pgsql-admin

Dear Team,
We are unable to connect to PostgreSQL db using psql by passing password
parameter. If we don't give password, then on password promt it's accepting
the password we type. But our scheduler script is having the psql line with
password parameter. Helps highly appreciated. Thanks in advance.
-
John

^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Passing password in psql command
@ 2015-03-02 09:33  Marco Nietz <pg@mnietz.de>
  parent: Technical Doubts <online.technicaldoubts@gmail.com>
  1 sibling, 0 replies; 4+ messages in thread

From: Marco Nietz @ 2015-03-02 09:33 UTC (permalink / raw)
  To: pgsql-admin

The best way is propably to use a .pgpass file, please see: 
https://wiki.postgresql.org/wiki/Pgpass for details

Marco

Am 02.03.2015 um 10:27 schrieb Technical Doubts:
> Dear Team,
> We are unable to connect to PostgreSQL db using psql by passing 
> password parameter. If we don't give password, then on password promt 
> it's accepting the password we type. But our scheduler script is 
> having the psql line with password parameter. Helps highly 
> appreciated. Thanks in advance.
> -
> John 



-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Passing password in psql command
@ 2015-03-02 09:42  hubert depesz lubaczewski <depesz@depesz.com>
  parent: Technical Doubts <online.technicaldoubts@gmail.com>
  1 sibling, 1 reply; 4+ messages in thread

From: hubert depesz lubaczewski @ 2015-03-02 09:42 UTC (permalink / raw)
  To: Technical Doubts <online.technicaldoubts@gmail.com>; +Cc: pgsql-admin

On Mon, Mar 02, 2015 at 02:57:46PM +0530, Technical Doubts wrote:
> Dear Team,
> We are unable to connect to PostgreSQL db using psql by passing password
> parameter. If we don't give password, then on password promt it's accepting
> the password we type. But our scheduler script is having the psql line with
> password parameter. Helps highly appreciated. Thanks in advance.

There is no option to provide password in command line.

You either have to use environment variable, as described here:
http://www.postgresql.org/docs/current/interactive/libpq-envars.html
or pgpass file, as described here:
http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html

Both of these places are listed in docs for psql
(http://www.postgresql.org/docs/current/interactive/app-psql.html) in
part "connecting to a database".

depesz

-- 
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/


-- 
Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-admin



^ permalink  raw  reply  [nested|flat] 4+ messages in thread

* Re: Passing password in psql command
@ 2015-03-02 10:35  Oleksandr Kylymnychenko <al.vikos@gmail.com>
  parent: hubert depesz lubaczewski <depesz@depesz.com>
  0 siblings, 0 replies; 4+ messages in thread

From: Oleksandr Kylymnychenko @ 2015-03-02 10:35 UTC (permalink / raw)
  To: depesz@depesz.com, Technical Doubts <online.technicaldoubts@gmail.com>; +Cc: pgsql-admin

Hi,

for a scripting solution if you don't want to use any possibilities mentioned
before, you might want to have a look at *expect* then to catch the prompt
and send your password.

Alex.

hubert depesz lubaczewski <depesz@depesz.com> schrieb am Mo., 2. März 2015
um 10:44 Uhr:

> On Mon, Mar 02, 2015 at 02:57:46PM +0530, Technical Doubts wrote:
> > Dear Team,
> > We are unable to connect to PostgreSQL db using psql by passing password
> > parameter. If we don't give password, then on password promt it's
> accepting
> > the password we type. But our scheduler script is having the psql line
> with
> > password parameter. Helps highly appreciated. Thanks in advance.
>
> There is no option to provide password in command line.
>
> You either have to use environment variable, as described here:
> http://www.postgresql.org/docs/current/interactive/libpq-envars.html
> or pgpass file, as described here:
> http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html
>
> Both of these places are listed in docs for psql
> (http://www.postgresql.org/docs/current/interactive/app-psql.html) in
> part "connecting to a database".
>
> depesz
>
> --
> The best thing about modern society is how easy it is to avoid contact
> with it.
>
> http://depesz.com/
>
>
> --
> Sent via pgsql-admin mailing list (pgsql-admin@postgresql.org)
> To make changes to your subscription:
> http://www.postgresql.org/mailpref/pgsql-admin
>

^ permalink  raw  reply  [nested|flat] 4+ messages in thread


end of thread, other threads:[~2015-03-02 10:35 UTC | newest]

Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2015-03-02 09:27 Passing password in psql command Technical Doubts <online.technicaldoubts@gmail.com>
2015-03-02 09:33 ` Marco Nietz <pg@mnietz.de>
2015-03-02 09:42 ` hubert depesz lubaczewski <depesz@depesz.com>
2015-03-02 10:35   ` Oleksandr Kylymnychenko <al.vikos@gmail.com>

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