X-Original-To: pgsql-admin@postgresql.org Received: from il.aduva.com (unknown [212.199.118.82]) by postgresql.org (Postfix) with ESMTP id B03A7475EB2 for ; Thu, 13 Mar 2003 04:03:14 -0500 (EST) Received: from aduva.com (romio.linuxqa.com [10.0.0.20]) by il.aduva.com (Postfix) with ESMTP id A82456C02B; Thu, 13 Mar 2003 10:43:32 +0200 (IST) Message-ID: <3E70490C.4080901@aduva.com> Date: Thu, 13 Mar 2003 11:02:04 +0200 From: Roman Gavrilov User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.1) Gecko/20020827 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Roman Gavrilov , pgsql-admin@postgresql.org Subject: Re: database privileges and access control References: <3E65FD8C.3080700@il.aduva.com> <20030310195025.GJ1941@plukwa.net> <3E6D9036.1050400@aduva.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Archive-Number: 200303/185 X-Sequence-Number: 7825 Roman Gavrilov wrote: > Artur Pietruk wrote: > >> On Wed, Mar 05, 2003 at 03:37:16PM +0200, Roman Gavrilov wrote: >> >> >>> Hello, >>> >>> I have 2 questions. >>> If I have user A and user B and database DB1 and database DB2 and >>> only local connections. >>> >>> How can I configure the pg_hba.conf to let user A connect only to >>> the DB1 database and let user B connect only to the DB2 database. >>> The sameuser param is not good here. >>> >>> local sameuser password >>> local all password admins >>> >>> The file $PGDATA/admins contains the usernames of all users that >>> allowed to connect to all databases. >>> I tried to add next line >>> local DB1 password DB1_users >>> local DB2 password DB2_users >>> >>> and added the users that allowed to connect to each database to >>> those files accordingly. >>> The user can connect to sameuser database but not to the DB1 or DB2 >>> database with error incorrect password. >>> >>> What is the problem ? >>> >> >> >> Which version of PostgreSQL are you using? >> >> With PG 7.3 there is easy solution to your problem. In that >> version, there is "user" field, for pg_hba.conf: >> >> # TYPE DATABASE USER IP-ADDRESS IP-MASK METHOD >> >> For your PG configuration - try to change order of entries in >> pg_hba.conf (order does matter), e.g. make it something like this: >> >> ====8<==== >> local DB1 password DB1_users >> local DB2 password DB2_users >> local all password admins >> local sameuser password >> ====8<==== >> >> Restart pgsql and see. >> >> > The version is 7.2.1 > and I tried to play with the order like you saying , but still it > didn't help :( > >> >> >>> Second problem is : >>> How can I make users to see only the database that they own with the >>> \l command ? >>> I don't want users to see all the databases on this host but only >>> those that they own. >>> >> >> >> AFAIK that's not possible. But I might be wrong - things were >> changing lately, check/search docs. >> >> Best regards, >> >> > > Thanks -- ----------------------------------------------------------------------------- Roman Gavrilov Aduva Inc., Web Development Services. work +972-3-7534373 mobile +972-54-834668 romio@aduva.com, romio@netvision.net.il