pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
connect to postgres from shell scripts
5+ messages / 5 participants
[nested] [flat]

* connect to postgres from shell scripts
@ 2005-08-22 15:42 Hemapriya <priyam_1121@yahoo.com>
  2005-08-22 17:34 ` Re: connect to postgres from shell scripts Devrim GUNDUZ <devrim@gunduz.org>
  2005-08-22 17:47 ` Re: connect to postgres from shell scripts Chris Travers <chris@metatrontech.com>
  0 siblings, 2 replies; 5+ messages in thread

From: Hemapriya @ 2005-08-22 15:42 UTC (permalink / raw)
  To: pgsql-admin

Hi,

I would like to know how to connect to postgres from
shell scripts using a password protected user.

Is there a way to embed the password in psql login.
It keeps prompting for the passwords.

Any hint is appreciated.

Thanks
Priya


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 



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

* Re: connect to postgres from shell scripts
  2005-08-22 15:42 connect to postgres from shell scripts Hemapriya <priyam_1121@yahoo.com>
@ 2005-08-22 17:34 ` Devrim GUNDUZ <devrim@gunduz.org>
  2005-08-22 18:59   ` Re: connect to postgres from shell scripts Tom Lane <tgl@sss.pgh.pa.us>
  1 sibling, 1 reply; 5+ messages in thread

From: Devrim GUNDUZ @ 2005-08-22 17:34 UTC (permalink / raw)
  To: Hemapriya <priyam_1121@yahoo.com>; +Cc: pgsql-admin

  This message is in MIME format.  The first part should be readable text,
  while the remaining parts are likely unreadable without MIME-aware tools.

--8323328-932793750-1124732087=:30926
Content-Type: TEXT/PLAIN; CHARSET=iso-8859-9; FORMAT=flowed
Content-Transfer-Encoding: 8BIT
Content-ID: <Pine.LNX.4.63.0508222034501.30926@emo.org.tr>

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

Hi,

On Mon, 22 Aug 2005, Hemapriya wrote:

> I would like to know how to connect to postgres from
> shell scripts using a password protected user.
>
> Is there a way to embed the password in psql login.
> It keeps prompting for the passwords.

psql checks for PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE and some 
other environmental variables. Export relevant values to the parameters.

http://www.postgresql.org/docs/8.0/static/libpq-envars.html

Also there's a .pgpass file thing:

http://www.postgresql.org/docs/8.0/static/libpq-pgpass.html

Regards,
- --
Devrim GUNDUZ
Kivi Biliþim Teknolojileri - http://www.kivi.com.tr
devrim~gunduz.org, devrim~PostgreSQL.org, devrim.gunduz~linux.org.tr
                      http://www.gunduz.org
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.1 (GNU/Linux)

iD8DBQFDCgzAtl86P3SPfQ4RAo5PAJ9y9Pm7ii8z50ZrSB7Bws1qhQU++gCfUepu
C3ErI3WBVLPIJ8ShVPE29Dk=
=dCI+
-----END PGP SIGNATURE-----
--8323328-932793750-1124732087=:30926--



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

* Re: connect to postgres from shell scripts
  2005-08-22 15:42 connect to postgres from shell scripts Hemapriya <priyam_1121@yahoo.com>
  2005-08-22 17:34 ` Re: connect to postgres from shell scripts Devrim GUNDUZ <devrim@gunduz.org>
@ 2005-08-22 18:59   ` Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 0 replies; 5+ messages in thread

From: Tom Lane @ 2005-08-22 18:59 UTC (permalink / raw)
  To: Devrim GUNDUZ <devrim@gunduz.org>; +Cc: Hemapriya <priyam_1121@yahoo.com>; pgsql-admin

Devrim GUNDUZ <devrim@gunduz.org> writes:
> psql checks for PGUSER, PGPASSWORD, PGHOST, PGPORT, PGDATABASE and some 
> other environmental variables. Export relevant values to the parameters.

PGPASSWORD is deprecated because it is insecure on some platforms
(to wit, those where other users can see a process' environment
variables via ps).  The ~/.pgpass file is the recommended way to go.

			regards, tom lane



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

* Re: connect to postgres from shell scripts
  2005-08-22 15:42 connect to postgres from shell scripts Hemapriya <priyam_1121@yahoo.com>
@ 2005-08-22 17:47 ` Chris Travers <chris@metatrontech.com>
  1 sibling, 0 replies; 5+ messages in thread

From: Chris Travers @ 2005-08-22 17:47 UTC (permalink / raw)
  To: Hemapriya <priyam_1121@yahoo.com>; pgsql-admin

Hemapriya wrote:

>Hi,
>
>I would like to know how to connect to postgres from
>shell scripts using a password protected user.
>  
>
psql is the simple way.

>Is there a way to embed the password in psql login.
>It keeps prompting for the passwords.
>
>  
>
Use the .pgpass file to store the password.

Best Wishes,
Chris Travers
Metatron Technology Consulting

Attachments:

chris.vcf (text/x-vcard, 125B) download begin:vcard fn:Chris Travers n:Travers;Chris email;internet:chris@metatrontech.com x-mozilla-html:FALSE version:2.1 end:vcard
^ permalink raw reply [nested|flat] 5+ messages in thread

* Re: connect to postgres from shell scripts
@ 2005-08-22 17:56 Jason Minion <jason.minion@sigler.com>
  0 siblings, 0 replies; 5+ messages in thread

From: Jason Minion @ 2005-08-22 17:56 UTC (permalink / raw)
  To: Hemapriya <priyam_1121@yahoo.com>; pgsql-admin

Take a look at the .pgpass file, some info at:

http://www.postgresql.org/docs/8.0/interactive/libpq-pgpass.html

Doing that, your password is still as secure as your .pgpass file,
which hopefully is more secure than your script.



-----Original Message-----
From: pgsql-admin-owner@postgresql.org
[mailto:pgsql-admin-owner@postgresql.org]On Behalf Of Hemapriya
Sent: Monday, August 22, 2005 10:43 AM
To: pgsql-admin@postgresql.org
Subject: [ADMIN] connect to postgres from shell scripts


Hi,

I would like to know how to connect to postgres from
shell scripts using a password protected user.

Is there a way to embed the password in psql login.
It keeps prompting for the passwords.

Any hint is appreciated.

Thanks
Priya


		
____________________________________________________
Start your day with Yahoo! - make it your home page 
http://www.yahoo.com/r/hs 
 

---------------------------(end of broadcast)---------------------------
TIP 6: explain analyze is your friend



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


end of thread, other threads:[~2005-08-22 18:59 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2005-08-22 15:42 connect to postgres from shell scripts Hemapriya <priyam_1121@yahoo.com>
2005-08-22 17:34 ` Devrim GUNDUZ <devrim@gunduz.org>
2005-08-22 18:59   ` Tom Lane <tgl@sss.pgh.pa.us>
2005-08-22 17:47 ` Chris Travers <chris@metatrontech.com>
2005-08-22 17:56 Re: connect to postgres from shell scripts Jason Minion <jason.minion@sigler.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