pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Connect to postgres from a script using password
3+ messages / 3 participants
[nested] [flat]

* Connect to postgres from a script using password
@ 2004-07-08 16:07  Hemapriya <priyam_1121@yahoo.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Hemapriya @ 2004-07-08 16:07 UTC (permalink / raw)
  To: pgsql-admin

Hi,

Can anyone tell me how to connect to postgres from a
shell script using password. If i use psql -UUser db
-W option it prompts for password everytime.. 
Is there anyway we can have the password included in
psql login command.?

Thanks
Priya


		
__________________________________
Do you Yahoo!?
Yahoo! Mail - Helps protect you from nasty viruses.
http://promotions.yahoo.com/new_mail



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

* Re: Connect to postgres from a script using password
@ 2004-07-08 16:44  Devrim GUNDUZ <devrim@gunduz.org>
  parent: Hemapriya <priyam_1121@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Devrim GUNDUZ @ 2004-07-08 16:44 UTC (permalink / raw)
  To: Hemapriya <priyam_1121@yahoo.com>; +Cc: pgsql-admin

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Hi,

On Thu, 8 Jul 2004, Hemapriya wrote:

> Can anyone tell me how to connect to postgres from a
> shell script using password. If i use psql -UUser db
> -W option it prompts for password everytime.. 
> Is there anyway we can have the password included in
> psql login command.?

Try environmental variables. I use this one:

==========================
export PGPASSWORD=password
export PGUSER=username
psql dbname
==========================

Using ~/.pgpass might be another alternative.

Regards,
- -- 
Devrim GUNDUZ	       
devrim~gunduz.org				devrim.gunduz~linux.org.tr 
			http://www.tdmsoft.com
			http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFA7Xnbtl86P3SPfQ4RAjNZAKDpOVd0wpOu0y3IDYPbq5tG9RFEgACeKDmC
Pgbg6AI0xK3vWh2fW3SCZ8Q=
=1Qfo
-----END PGP SIGNATURE-----




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

* Re: Connect to postgres from a script using password
@ 2004-07-08 16:47  Bruno Wolff III <bruno@wolff.to>
  parent: Hemapriya <priyam_1121@yahoo.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Bruno Wolff III @ 2004-07-08 16:47 UTC (permalink / raw)
  To: Hemapriya <priyam_1121@yahoo.com>; +Cc: pgsql-admin

On Thu, Jul 08, 2004 at 09:07:30 -0700,
  Hemapriya <priyam_1121@yahoo.com> wrote:
> Hi,
> 
> Can anyone tell me how to connect to postgres from a
> shell script using password. If i use psql -UUser db
> -W option it prompts for password everytime.. 
> Is there anyway we can have the password included in
> psql login command.?

You can keep the password in ~/.pgpass or you can use ident authentication.
In at least some versions you can pass it through an environment variable,
but you don't want to do that if there are untrusted users with shell
access to the host, as environment variables are typically visible to other
users.



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


end of thread, other threads:[~2004-07-08 16:47 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-07-08 16:07 Connect to postgres from a script using password Hemapriya <priyam_1121@yahoo.com>
2004-07-08 16:44 ` Devrim GUNDUZ <devrim@gunduz.org>
2004-07-08 16:47 ` Bruno Wolff III <bruno@wolff.to>

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