Received: from sss.pgh.pa.us ([192.204.191.242]) by postgresql.org (8.11.3/8.11.4) with ESMTP id f7LDaIP04225 for ; Tue, 21 Aug 2001 09:36:18 -0400 (EDT) (envelope-from tgl@sss.pgh.pa.us) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.11.4/8.11.4) with ESMTP id f7LDZgY28940; Tue, 21 Aug 2001 09:35:42 -0400 (EDT) To: "Chad R. Larson" cc: "C. Bensend" , pgsql-admin@postgresql.org Subject: Re: Multiple Servers In-reply-to: <4.2.2.20010820220921.00a55ac0@smtp.eldocomp.com> References: <27213.998361211@sss.pgh.pa.us> <4.2.2.20010820220921.00a55ac0@smtp.eldocomp.com> Comments: In-reply-to "Chad R. Larson" message dated "Mon, 20 Aug 2001 22:13:06 -0700" Date: Tue, 21 Aug 2001 09:35:41 -0400 Message-ID: <28937.998400941@sss.pgh.pa.us> From: Tom Lane X-Archive-Number: 200108/87 X-Sequence-Number: 2023 "Chad R. Larson" writes: > So, create a database for the user as the user, but deny him the ability to > create databases or users. This is actually a tad easier said than done, since the only way we provide to create a database owned by a user is to create it *as* that user. (CREATE DATABASE probably ought to have an OWNER option available only to superusers, now that I think about it.) So you have two possible approaches: 1. create user with createdb option, become user, create his database, become superuser again, ALTER USER user NOCREATEDB. 2. create user without createdb option, create his database (as yourself), then alter pg_database to make him the owner: update pg_database set datdba = (select usesysid from pg_shadow where usename = 'foo') where datname = 'foo'; > Then he can dick with his own database to his heart's desire, but that > would be his only sandbox. You'll probably also want to ensure that each user can only connect to his own database. The 'sameuser' option in pg_hba.conf will help here. Don't forget to leave an escape hatch for the superuser (ie, you) to connect to anything. regards, tom lane