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 A3FFE9DC828 for ; Fri, 3 Feb 2006 19:48:39 -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 44834-01 for ; Fri, 3 Feb 2006 19:48:41 -0400 (AST) Received: from svr4.postgresql.org (svr4.postgresql.org [66.98.251.159]) by postgresql.org (Postfix) with ESMTP id 3528C9DC80C for ; Fri, 3 Feb 2006 19:48:37 -0400 (AST) Received: from mx1.redhat.com (mx1.redhat.com [66.187.233.31]) by svr4.postgresql.org (Postfix) with ESMTP id B70F05AF199 for ; Fri, 3 Feb 2006 23:48:40 +0000 (GMT) Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.12.11/8.12.11) with ESMTP id k13NmcrQ003553 for ; Fri, 3 Feb 2006 18:48:38 -0500 Received: from mail.boston.redhat.com (mail.boston.redhat.com [172.16.76.12]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with ESMTP id k13Nmc116568 for ; Fri, 3 Feb 2006 18:48:38 -0500 Received: from vpn50-16.rdu.redhat.com (vpn50-16.rdu.redhat.com [172.16.50.16]) by mail.boston.redhat.com (8.12.8/8.12.8) with ESMTP id k13NmbRK015547 for ; Fri, 3 Feb 2006 18:48:37 -0500 Subject: su-like behavior From: David Lutterkort To: pgsql-admin@postgresql.org Content-Type: text/plain Organization: Red Hat Inc Date: Fri, 03 Feb 2006 15:48:35 -0800 Message-Id: <1139010516.27326.211.camel@currant.watzmann.net> Mime-Version: 1.0 X-Mailer: Evolution 2.2.3 (2.2.3-2.fc4) Content-Transfer-Encoding: 7bit X-Virus-Scanned: by amavisd-new at hub.org X-Spam-Status: No, score=0 required=5 tests=[none] X-Spam-Score: 0 X-Spam-Level: X-Archive-Number: 200602/32 X-Sequence-Number: 20453 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 ? thanks, David