pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: David Lutterkort <dlutter@redhat.com>
To: pgsql-admin@postgresql.org
Subject: su-like behavior
Date: Fri, 03 Feb 2006 15:48:35 -0800
Message-ID: <1139010516.27326.211.camel@currant.watzmann.net> (raw)

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





view thread (3+ messages)  latest in thread

Message-ID: <1139010516.27326.211.camel@currant.watzmann.net>
Permalink:  ../1139010516.27326.211.camel@currant.watzmann.net/
Also on:    postgresql.org/message-id/1139010516.27326.211.camel@currant.watzmann.net

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: dlutter@redhat.com
  Subject: Re: su-like behavior
  In-Reply-To: <1139010516.27326.211.camel@currant.watzmann.net>
  References: <1139010516.27326.211.camel@currant.watzmann.net>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox