Re: Postgres in bash-mode

From: Karl DeBisschop <kdebisschop(at)range(dot)infoplease(dot)com>
To: David Terrell <dbt(at)meat(dot)net>
Cc: Alexander Pucher <pucher(at)atlas(dot)gis(dot)univie(dot)ac(dot)at>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Postgres in bash-mode
Date: 2002-01-12 14:03:44
Message-ID: 1010844224.10717.13.camel@toaster
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, 2002-01-12 at 03:32, David Terrell wrote:
> On Thu, Jan 10, 2002 at 09:07:50AM +0100, Alexander Pucher wrote:
> > Hi,
> >
> > I hope, that this is not too off topic for this list, but anyway, it
> > should be easy for any PG-expert.
> >
> > I need to run a shell script that logs in to Postgresql, executes a
> > query and logs off again.
> >
> > In MySQL, I did it like this:
> >
> > 'mysql -u user -ppassword < script.sh'
> >
> > My problem is that I can't find a way to put the password in an 'psql'
> > statement at the prompt.
> >
> > Any suggestions are welcome!
>
> "Don't do that"
>
> You CAN do something like
> % psql -f dbscript database
> Password: <typeity>
> <stuff happens>
> 129195981 INSERT

Just a bit of extra info. Passwords on the command line are sniffable.
You can obsure them somewhat, but AFAIK there is no way, or at least no
general way to secure them fully.

If you absolutely need to do something like this, look into expect.

--
Karl

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Hannu Krosing 2002-01-12 14:51:23 Re: checkpoint hang in 7.2b4
Previous Message Daniel Kalchev 2002-01-12 11:51:23 Re: again on index usage