pg.ddx.io pgsql-admin@postgresql.org mailing list archive
help / color / mirror / Atom feedsu-like behavior
3+ messages / 3 participants
[nested] [flat]
* su-like behavior
@ 2006-02-03 23:48 David Lutterkort <dlutter@redhat.com>
2006-02-04 02:52 ` Re: su-like behavior Bruno Wolff III <bruno@wolff.to>
0 siblings, 1 reply; 3+ messages in thread
From: David Lutterkort @ 2006-02-03 23:48 UTC (permalink / raw)
To: 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
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: su-like behavior
2006-02-03 23:48 su-like behavior David Lutterkort <dlutter@redhat.com>
@ 2006-02-04 02:52 ` Bruno Wolff III <bruno@wolff.to>
2006-02-04 04:04 ` Re: su-like behavior Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 1 reply; 3+ messages in thread
From: Bruno Wolff III @ 2006-02-04 02:52 UTC (permalink / raw)
To: David Lutterkort <dlutter@redhat.com>; +Cc: pgsql-admin
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.
^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: su-like behavior
2006-02-03 23:48 su-like behavior David Lutterkort <dlutter@redhat.com>
2006-02-04 02:52 ` Re: su-like behavior Bruno Wolff III <bruno@wolff.to>
@ 2006-02-04 04:04 ` Alvaro Herrera <alvherre@commandprompt.com>
0 siblings, 0 replies; 3+ messages in thread
From: Alvaro Herrera @ 2006-02-04 04:04 UTC (permalink / raw)
To: Bruno Wolff III <bruno@wolff.to>; David Lutterkort <dlutter@redhat.com>; pgsql-admin
Bruno Wolff III wrote:
> On Fri, Feb 03, 2006 at 15:48:35 -0800,
> David Lutterkort <dlutter@redhat.com> wrote:
> > [start as root]
> > su - postgres
> > psql
> > \connect DBNAME DBUSER
> > \i script.sql
Instead of using \connect, use SET SESSION AUTHORIZATION (and connect to
the right database in the first place).
--
Alvaro Herrera http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.
^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2006-02-04 04:04 UTC | newest]
Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2006-02-03 23:48 su-like behavior David Lutterkort <dlutter@redhat.com>
2006-02-04 02:52 ` Bruno Wolff III <bruno@wolff.to>
2006-02-04 04:04 ` Alvaro Herrera <alvherre@commandprompt.com>
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