pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedpsql shell with no password prompt
9+ messages / 5 participants
[nested] [flat]
* psql shell with no password prompt
@ 2010-07-27 16:53 Steve.Toutant@inspq.qc.ca
0 siblings, 2 replies; 9+ messages in thread
From: Steve.Toutant@inspq.qc.ca @ 2010-07-27 16:53 UTC (permalink / raw)
To: pgsql-admin
Hi,
I created several SQL that are automatically executed via windows task
scheduler, here is an example
psql -U "dbadmin" -d mydb -f D:\script.sql
It was running well until I changed the user (to open a session)
associated to these task.
The script prompt for a password for user dbadmin.
How to avoid that? I guess there is a config so dbadmin will "trust" this
new user....
Thanks for your help,
Steve
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 17:17 Kevin Grittner <Kevin.Grittner@wicourts.gov>
parent: Steve.Toutant@inspq.qc.ca
1 sibling, 1 reply; 9+ messages in thread
From: Kevin Grittner @ 2010-07-27 17:17 UTC (permalink / raw)
To: Steve.Toutant@inspq.qc.ca; pgsql-admin
<Steve.Toutant@inspq.qc.ca> wrote:
> The script prompt for a password for user dbadmin.
> How to avoid that? I guess there is a config so dbadmin will
> "trust" this new user....
You can use pg_hba.conf or pgpass:
http://www.postgresql.org/docs/current/interactive/auth-pg-hba-conf.html
http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html
-Kevin
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 18:16 Steve.Toutant@inspq.qc.ca
parent: Kevin Grittner <Kevin.Grittner@wicourts.gov>
0 siblings, 2 replies; 9+ messages in thread
From: Steve.Toutant@inspq.qc.ca @ 2010-07-27 18:16 UTC (permalink / raw)
To: Kevin Grittner <Kevin.Grittner@wicourts.gov>; +Cc: pgsql-admin
Thanks Kevin,
Which of these 2 methods is the best practice?
It is working with pgpass.
But not yet with hba.conf
I tried this without success.
host all all 127.0.0.1/32 trust
steve
"Kevin Grittner" <Kevin.Grittner@wicourts.gov>
27/07/2010 01:17 PM
A
<Steve.Toutant@inspq.qc.ca>, <pgsql-admin@postgresql.org>
cc
Objet
Re: [ADMIN] psql shell with no password prompt
<Steve.Toutant@inspq.qc.ca> wrote:
> The script prompt for a password for user dbadmin.
> How to avoid that? I guess there is a config so dbadmin will
> "trust" this new user....
You can use pg_hba.conf or pgpass:
http://www.postgresql.org/docs/current/interactive/auth-pg-hba-conf.html
http://www.postgresql.org/docs/current/interactive/libpq-pgpass.html
-Kevin
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 18:24 Joshua D. Drake <jd@commandprompt.com>
parent: Steve.Toutant@inspq.qc.ca
1 sibling, 1 reply; 9+ messages in thread
From: Joshua D. Drake @ 2010-07-27 18:24 UTC (permalink / raw)
To: Steve.Toutant@inspq.qc.ca; +Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>; pgsql-admin
On Tue, 2010-07-27 at 14:16 -0400, Steve.Toutant@inspq.qc.ca wrote:
>
> Thanks Kevin,
> Which of these 2 methods is the best practice?
>
> It is working with pgpass.
> But not yet with hba.conf
> I tried this without success.
> host all all 127.0.0.1/32 trust
>
>
> steve
Best practice? Use .pgpass, not trust.
JD
--
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 18:34 Kevin Grittner <Kevin.Grittner@wicourts.gov>
parent: Joshua D. Drake <jd@commandprompt.com>
0 siblings, 0 replies; 9+ messages in thread
From: Kevin Grittner @ 2010-07-27 18:34 UTC (permalink / raw)
To: jd@commandprompt.com; Steve.Toutant@inspq.qc.ca; +Cc: pgsql-admin
"Joshua D. Drake" <jd@commandprompt.com> wrote:
> Best practice? Use .pgpass, not trust.
I would take ident over either in Linux; but the OP is on Windows
and I don't know if that's an option or, if so, how safe it is.
-Kevin
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 19:34 Scott Marlowe <scott.marlowe@gmail.com>
parent: Steve.Toutant@inspq.qc.ca
1 sibling, 0 replies; 9+ messages in thread
From: Scott Marlowe @ 2010-07-27 19:34 UTC (permalink / raw)
To: Steve.Toutant@inspq.qc.ca; +Cc: Kevin Grittner <Kevin.Grittner@wicourts.gov>; pgsql-admin
On Tue, Jul 27, 2010 at 12:16 PM, <Steve.Toutant@inspq.qc.ca> wrote:
>
> Thanks Kevin,
> Which of these 2 methods is the best practice?
>
> It is working with pgpass.
> But not yet with hba.conf
> I tried this without success.
> host all all 127.0.0.1/32 trust
You have to reload / restart the pg service for that to take effect.
Note that will only affect incoming connections on the same machine.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 21:56 Walter Willmertinger <willmis@gmail.com>
parent: Steve.Toutant@inspq.qc.ca
1 sibling, 1 reply; 9+ messages in thread
From: Walter Willmertinger @ 2010-07-27 21:56 UTC (permalink / raw)
To: pgsql-admin
You can set user and password with environment variables (PGUSER and
PGPASSWORD) , also in a Windows batch or program.
SET PGPASSWORD=xxxyyyzzz
psql -U "dbadmin" -d mydb -f D:\script.sql
Regards
Walter
On Tue, Jul 27, 2010 at 6:53 PM, <Steve.Toutant@inspq.qc.ca> wrote:
>
> Hi,
> I created several SQL that are automatically executed via windows task
> scheduler, here is an example
> psql -U "dbadmin" -d mydb -f D:\script.sql
>
> It was running well until I changed the user (to open a session) associated
> to these task.
> The script prompt for a password for user dbadmin.
>
> How to avoid that? I guess there is a config so dbadmin will "trust" this
> new user....
>
> Thanks for your help,
>
> Steve
>
>
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-27 23:02 Scott Marlowe <scott.marlowe@gmail.com>
parent: Walter Willmertinger <willmis@gmail.com>
0 siblings, 1 reply; 9+ messages in thread
From: Scott Marlowe @ 2010-07-27 23:02 UTC (permalink / raw)
To: Walter Willmertinger <willmis@gmail.com>; +Cc: pgsql-admin
However, those are deprecated, and the .pgpass is considered the
preferred method.
On Tue, Jul 27, 2010 at 3:56 PM, Walter Willmertinger <willmis@gmail.com> wrote:
> You can set user and password with environment variables (PGUSER and
> PGPASSWORD) , also in a Windows batch or program.
> SET PGPASSWORD=xxxyyyzzz
> psql -U "dbadmin" -d mydb -f D:\script.sql
>
>
>
> Regards
>
> Walter
>
>
> On Tue, Jul 27, 2010 at 6:53 PM, <Steve.Toutant@inspq.qc.ca> wrote:
>>
>> Hi,
>> I created several SQL that are automatically executed via windows task
>> scheduler, here is an example
>> psql -U "dbadmin" -d mydb -f D:\script.sql
>>
>> It was running well until I changed the user (to open a session)
>> associated to these task.
>> The script prompt for a password for user dbadmin.
>>
>> How to avoid that? I guess there is a config so dbadmin will "trust" this
>> new user....
>>
>> Thanks for your help,
>>
>> Steve
>
--
To understand recursion, one must first understand recursion.
^ permalink raw reply [nested|flat] 9+ messages in thread
* Re: psql shell with no password prompt
@ 2010-07-28 21:02 Walter Willmertinger <willmis@gmail.com>
parent: Scott Marlowe <scott.marlowe@gmail.com>
0 siblings, 0 replies; 9+ messages in thread
From: Walter Willmertinger @ 2010-07-28 21:02 UTC (permalink / raw)
To: Scott Marlowe <scott.marlowe@gmail.com>; +Cc: pgsql-admin
I hope the method with the environment variables will hold on.
For security reasons it is much better to use the variable method with
PGPASSWORD. I can set the environment hidden from any user by a program.
The .pgpass is readable for any admin, opposed to the statement in the docs:
"On Microsoft Windows, it is assumed that the file is stored in a directory
that is secure, so no special permissions check is made."
Regards
Walter
On Wed, Jul 28, 2010 at 1:02 AM, Scott Marlowe <scott.marlowe@gmail.com>wrote:
> However, those are deprecated, and the .pgpass is considered the
> preferred method.
>
> On Tue, Jul 27, 2010 at 3:56 PM, Walter Willmertinger <willmis@gmail.com>
> wrote:
> > You can set user and password with environment variables (PGUSER and
> > PGPASSWORD) , also in a Windows batch or program.
> > SET PGPASSWORD=xxxyyyzzz
> > psql -U "dbadmin" -d mydb -f D:\script.sql
> >
> >
> >
> > Regards
> >
> > Walter
> >
> >
> > On Tue, Jul 27, 2010 at 6:53 PM, <Steve.Toutant@inspq.qc.ca> wrote:
> >>
> >> Hi,
> >> I created several SQL that are automatically executed via windows task
> >> scheduler, here is an example
> >> psql -U "dbadmin" -d mydb -f D:\script.sql
> >>
> >> It was running well until I changed the user (to open a session)
> >> associated to these task.
> >> The script prompt for a password for user dbadmin.
> >>
> >> How to avoid that? I guess there is a config so dbadmin will "trust"
> this
> >> new user....
> >>
> >> Thanks for your help,
> >>
> >> Steve
> >
>
>
>
> --
> To understand recursion, one must first understand recursion.
>
^ permalink raw reply [nested|flat] 9+ messages in thread
end of thread, other threads:[~2010-07-28 21:02 UTC | newest]
Thread overview: 9+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2010-07-27 16:53 psql shell with no password prompt Steve.Toutant@inspq.qc.ca
2010-07-27 17:17 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-07-27 18:16 ` Steve.Toutant@inspq.qc.ca
2010-07-27 18:24 ` Joshua D. Drake <jd@commandprompt.com>
2010-07-27 18:34 ` Kevin Grittner <Kevin.Grittner@wicourts.gov>
2010-07-27 19:34 ` Scott Marlowe <scott.marlowe@gmail.com>
2010-07-27 21:56 ` Walter Willmertinger <willmis@gmail.com>
2010-07-27 23:02 ` Scott Marlowe <scott.marlowe@gmail.com>
2010-07-28 21:02 ` Walter Willmertinger <willmis@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