X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (unknown [200.46.204.144]) by svr1.postgresql.org (Postfix) with ESMTP id 33531D1B378 for ; Thu, 8 Jul 2004 13:40:47 -0300 (ADT) Received: from svr1.postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 56206-05 for ; Thu, 8 Jul 2004 16:40:45 +0000 (GMT) Received: from wolff.to (wolff.to [66.93.249.74]) by svr1.postgresql.org (Postfix) with SMTP id 095BCD1B344 for ; Thu, 8 Jul 2004 13:40:42 -0300 (ADT) Received: (qmail 5281 invoked by uid 500); 8 Jul 2004 16:47:36 -0000 Date: Thu, 8 Jul 2004 11:47:36 -0500 From: Bruno Wolff III To: Hemapriya Cc: pgsql-admin@postgresql.org Subject: Re: Connect to postgres from a script using password Message-ID: <20040708164736.GA5140@wolff.to> Mail-Followup-To: Hemapriya , pgsql-admin@postgresql.org References: <20040708160730.73409.qmail@web21326.mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20040708160730.73409.qmail@web21326.mail.yahoo.com> User-Agent: Mutt/1.5.6i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, hits=0.0 tagged_above=0.0 required=5.0 tests= X-Spam-Level: X-Archive-Number: 200407/105 X-Sequence-Number: 14173 On Thu, Jul 08, 2004 at 09:07:30 -0700, Hemapriya 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.