su-like behavior

From: David Lutterkort <dlutter(at)redhat(dot)com>
To: pgsql-admin(at)postgresql(dot)org
Subject: su-like behavior
Date: 2006-02-03 23:48:35
Message-ID: 1139010516.27326.211.camel@currant.watzmann.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-admin

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

Responses

Browse pgsql-admin by date

  From Date Subject
Next Message Bruno Wolff III 2006-02-04 02:52:49 Re: su-like behavior
Previous Message Tom Lane 2006-02-03 04:47:20 Re: strange hung processes