Re: Connect to postgres from a script using password

From: Bruno Wolff III <bruno(at)wolff(dot)to>
To: Hemapriya <priyam_1121(at)yahoo(dot)com>
Cc: pgsql-admin(at)postgresql(dot)org
Subject: Re: Connect to postgres from a script using password
Date: 2004-07-08 16:47:36
Message-ID: 20040708164736.GA5140@wolff.to
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

On Thu, Jul 08, 2004 at 09:07:30 -0700,
Hemapriya <priyam_1121(at)yahoo(dot)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.

In response to

Browse pgsql-admin by date

  From Date Subject
Next Message Scott Marlowe 2004-07-08 16:50:46 Re:
Previous Message Stephan Szabo 2004-07-08 16:46:46 Re: Strange scenary.