Received: from localhost (postgresql.org [64.49.215.8]) by postgresql.org (Postfix) with ESMTP id 642F1475C81 for ; Thu, 29 Aug 2002 14:16:16 -0400 (EDT) Received: from candle.pha.pa.us (216-55-132-35.dsl.san-diego.abac.net [216.55.132.35]) by postgresql.org (Postfix) with ESMTP id 2B9634767A9 for ; Thu, 29 Aug 2002 14:16:14 -0400 (EDT) Received: (from pgman@localhost) by candle.pha.pa.us (8.11.6/8.10.1) id g7TIFqC13365; Thu, 29 Aug 2002 14:15:52 -0400 (EDT) From: Bruce Momjian Message-Id: <200208291815.g7TIFqC13365@candle.pha.pa.us> Subject: Re: Passwords and batch processes (was Re: Problem with Dump) In-Reply-To: <200208231834.48086.ian@barwick.de> To: Ian Barwick Date: Thu, 29 Aug 2002 14:15:52 -0400 (EDT) Cc: "David F. Skoll" , pgsql-admin@postgresql.org X-Mailer: ELM [version 2.4ME+ PL99 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Virus-Scanned: by AMaViS new-20020517 X-Archive-Number: 200208/363 X-Sequence-Number: 5477 In 7.3, this is the docs for PGPASSWORD: PGPASSWORD sets the password used if the backend demands password authentication. This functionality is deprecated for security reasons; consider migrating to PGPASSWORDFILE. It is more vague on the security issues, but it does recommend a new feature PGPASSWORDFILE, which will allow the passwords to be kept in a file: PGPASSWORDFILE sets the password file used if the backend demands password authentication. This file should have the format hostname:port:database:username:password Any of these may be a literal name, or a * that matches anything. The first match will be the one used, so put more specific entries first. Entries with : or \ should be escaped with \. --------------------------------------------------------------------------- Ian Barwick wrote: > On Friday 23 August 2002 17:47, David F. Skoll wrote: > > On Fri, 23 Aug 2002, Ian Barwick wrote: > > > AFAIK utilities such as pg_dump prompt for the password but > > > won't accept it as a command line option, which makes password-based > > > authentication almost unusable when calling these utilities from a > > > script. > > > > This really should be Question #1 in the FAQ. > > > > You can set the environment variable PGPASSWORD to the password, and avoid > > prompts. This assumes the same username/password has access to all the > > databases for pg_dumpall. > > > > I didn't find this documented anywhere. It probably is, but somewhere > > buried... > > here?: > http://www.postgresql.org/idocs/index.php?libpq-envars.html > > The security-conscious might like to note: > > "PGPASSWORD sets the password used if the backend demands password > authentication. This is not recommended because the password can be read by > others using the ps command with special options on some platforms." > > (At least on FreeBSD ps can be made to show the calling user's, but no > other users' environment variables). > > Should this be included in the FAQ (it doesn't seem to be) I would include > the recommendation that the permissions of any file where PGPASSWORD is set > should be checked carefully. > > Ian Barwick > barwick@gmx.net > > > > ---------------------------(end of broadcast)--------------------------- > TIP 1: subscribe and unsubscribe commands go to majordomo@postgresql.org > -- Bruce Momjian | http://candle.pha.pa.us pgman@candle.pha.pa.us | (610) 359-1001 + If your life is a hard drive, | 13 Roberts Road + Christ can be your backup. | Newtown Square, Pennsylvania 19073