X-Original-To: pgsql-admin-postgresql.org@localhost.postgresql.org Received: from localhost (av.hub.org [200.46.204.144]) by postgresql.org (Postfix) with ESMTP id 1A6429DC871 for ; Fri, 3 Feb 2006 22:44:27 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (av.hub.org [200.46.204.144]) (amavisd-new, port 10024) with ESMTP id 97284-08 for ; Fri, 3 Feb 2006 22:44:31 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey- Received: from wolff.to (wolff.to [66.93.197.194]) by postgresql.org (Postfix) with SMTP id 8A7C89DC83E for ; Fri, 3 Feb 2006 22:44:24 -0400 (AST) Received: (qmail 20120 invoked by uid 500); 4 Feb 2006 02:52:49 -0000 Date: Fri, 3 Feb 2006 20:52:49 -0600 From: Bruno Wolff III To: David Lutterkort Cc: pgsql-admin@postgresql.org Subject: Re: su-like behavior Message-ID: <20060204025249.GA19279@wolff.to> Mail-Followup-To: Bruno Wolff III , David Lutterkort , pgsql-admin@postgresql.org References: <1139010516.27326.211.camel@currant.watzmann.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1139010516.27326.211.camel@currant.watzmann.net> User-Agent: Mutt/1.4.2.1i X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0.09 required=5 tests=[AWL=0.090] X-Spam-Score: 0.09 X-Spam-Level: X-Archive-Number: 200602/33 X-Sequence-Number: 20454 On Fri, Feb 03, 2006 at 15:48:35 -0800, David Lutterkort wrote: > Hi, > > I want to run some sql scripts through psql from a process that runs as > root. Since I have no reason to trust the sql scripts, I want to run > them in psql as a specific database user that doesn't have a > corresponding login account, i.e. I want to do something like > > [start as root] > su - postgres > psql DBNAME DBUSER < script.sql > > or > [start as root] > su - postgres > psql > \connect DBNAME DBUSER > \i script.sql > > The problem is that I haven't been able to do this without being > prompted for a password. Is this possible, i.e. is there a way to go > from a superuser (postgres) to a less privileged user without having to > supply the password ? You could use ident authentication and let the OS 'postgres' user connect as any postgres user.