pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Re: psql  Automatic login In Bash Script
5+ messages / 3 participants
[nested] [flat]

* psql  Automatic login In Bash Script
@ 2004-01-13 19:47 Sai Hertz And Control Systems <sank89@sancharnet.in>
  2004-01-13 19:47 ` Re: psql  Automatic login In Bash Script Peter Eisentraut <peter.eisentraut@credativ.de>
  0 siblings, 1 reply; 5+ messages in thread

From: Sai Hertz And Control Systems @ 2004-01-13 19:47 UTC (permalink / raw)
  To: pgsql-admin

Dear all ,

I know this is a wrong list to for this post

Anyways

We use bash script for database maintainace and  implimenting new  
schema in the production database
the script goes as
<code>
#!/bin/sh
until [ "$uname" ]
do
read -s uname
done
until [ "$pass"  ]
do
read -s pass
done
psql -U $uname mydatabase -f  ./my_functions.sql
psql -U $uname mydatabase -f  ./my_tables.sql
psql -U $uname mydatabase -f  ./my_views.sql
</code>
The problem is psql has no option  such that I can pass on the variable 
$pass for password 
and as you can see I have to type in  password three times  (in real 
case 10 times)

What I need is since password be stored in the bash variable for  once I 
may pass on the variable with password to
psql
pg_dump
pg_restore
and my database migration would go smothly

Also would not like to set ~/.pgpass

Would be greateful  to you all  for any kinda help .


Regards,
Vishal Kashyap



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

* Re: psql  Automatic login In Bash Script
  2004-01-13 19:47 psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
@ 2004-01-13 19:47 ` Peter Eisentraut <peter.eisentraut@credativ.de>
  2004-01-13 20:00   ` Re: psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2004-01-13 19:47 UTC (permalink / raw)
  To: aspire420@hotpop.com, Sai Hertz And Control Systems <sank89@sancharnet.in>; pgsql-admin

Sai Hertz And Control Systems wrote:
> What I need is since password be stored in the bash variable for 
> once I may pass on the variable with password to
> psql
> pg_dump
> pg_restore
> and my database migration would go smothly

That would be a security hole because then other users can read the 
password using 'ps'.

> Also would not like to set ~/.pgpass

Why not?  That's what it's for.




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

* Re: psql  Automatic login In Bash Script
  2004-01-13 19:47 psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
  2004-01-13 19:47 ` Re: psql  Automatic login In Bash Script Peter Eisentraut <peter.eisentraut@credativ.de>
@ 2004-01-13 20:00   ` Sai Hertz And Control Systems <sank89@sancharnet.in>
  2004-01-13 20:05     ` Re: psql  Automatic login In Bash Script Peter Eisentraut <peter_e@gmx.net>
  0 siblings, 1 reply; 5+ messages in thread

From: Sai Hertz And Control Systems @ 2004-01-13 20:00 UTC (permalink / raw)
  To: Peter Eisentraut <peter.eisentraut@credativ.de>; +Cc: aspire420@hotpop.com; pgsql-admin

Dear Peter Eisentraut

>>and my database migration would go smothly
>>    
>>
>
>That would be a security hole because then other users can read the 
>password using 'ps'.
>
>>Also would not like to set ~/.pgpass
>>Why not?  That's what it's for.
>>    
>>
Agreed and now we decided to use it but  will ~/.pgpass work for
pg_dump
pg_restore

Regards,
Vishal Kashyap




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

* Re: psql  Automatic login In Bash Script
  2004-01-13 19:47 psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
  2004-01-13 19:47 ` Re: psql  Automatic login In Bash Script Peter Eisentraut <peter.eisentraut@credativ.de>
  2004-01-13 20:00   ` Re: psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
@ 2004-01-13 20:05     ` Peter Eisentraut <peter_e@gmx.net>
  2004-01-13 20:32       ` Re: psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
  0 siblings, 1 reply; 5+ messages in thread

From: Peter Eisentraut @ 2004-01-13 20:05 UTC (permalink / raw)
  To: aspire420@hotpop.com, Sai Hertz And Control Systems <sank89@sancharnet.in>; +Cc: pgsql-admin

Sai Hertz And Control Systems wrote:
> Agreed and now we decided to use it but  will ~/.pgpass work for
> pg_dump
> pg_restore

Yes, it works for all libpq programs.




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

* Re: psql  Automatic login In Bash Script
  2004-01-13 19:47 psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
  2004-01-13 19:47 ` Re: psql  Automatic login In Bash Script Peter Eisentraut <peter.eisentraut@credativ.de>
  2004-01-13 20:00   ` Re: psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
  2004-01-13 20:05     ` Re: psql  Automatic login In Bash Script Peter Eisentraut <peter_e@gmx.net>
@ 2004-01-13 20:32       ` Sai Hertz And Control Systems <sank89@sancharnet.in>
  0 siblings, 0 replies; 5+ messages in thread

From: Sai Hertz And Control Systems @ 2004-01-13 20:32 UTC (permalink / raw)
  To: Peter Eisentraut <peter_e@gmx.net>; +Cc: pgsql-admin

Dear Peter Eisentraut  ,

Loads of thanks for you kind and much needed help.

Best Regards,
Vishal Kashyap

>>Agreed and now we decided to use it but  will ~/.pgpass work for
>>pg_dump
>>pg_restore
>>    
>>
>
>Yes, it works for all libpq programs.
>
>
>---------------------------(end of broadcast)---------------------------
>TIP 5: Have you checked our extensive FAQ?
>
>               http://www.postgresql.org/docs/faqs/FAQ.html
>
>
>  
>




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


end of thread, other threads:[~2004-01-13 20:32 UTC | newest]

Thread overview: 5+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2004-01-13 19:47 psql  Automatic login In Bash Script Sai Hertz And Control Systems <sank89@sancharnet.in>
2004-01-13 19:47 ` Peter Eisentraut <peter.eisentraut@credativ.de>
2004-01-13 20:00   ` Sai Hertz And Control Systems <sank89@sancharnet.in>
2004-01-13 20:05     ` Peter Eisentraut <peter_e@gmx.net>
2004-01-13 20:32       ` Sai Hertz And Control Systems <sank89@sancharnet.in>

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