pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: David Lutterkort <dlutter@redhat.com>
Cc: pgsql-admin@postgresql.org
Subject: Re: su-like behavior
Date: Fri, 3 Feb 2006 20:52:49 -0600
Message-ID: <20060204025249.GA19279@wolff.to> (raw)
In-Reply-To: <1139010516.27326.211.camel@currant.watzmann.net>
References: <1139010516.27326.211.camel@currant.watzmann.net>

On Fri, Feb 03, 2006 at 15:48:35 -0800,
  David Lutterkort <dlutter@redhat.com> 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.



view thread (3+ messages)  latest in thread

Message-ID: <20060204025249.GA19279@wolff.to>
Permalink:  ../20060204025249.GA19279@wolff.to/
Also on:    postgresql.org/message-id/20060204025249.GA19279@wolff.to

 · 

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: bruno@wolff.to, dlutter@redhat.com
  Subject: Re: su-like behavior
  In-Reply-To: <20060204025249.GA19279@wolff.to>
  References: <1139010516.27326.211.camel@currant.watzmann.net> <20060204025249.GA19279@wolff.to>

* 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