Re: Preventing access of user1 to user2's database - Mailing list pgsql-novice

From Tom Lane
Subject Re: Preventing access of user1 to user2's database
Date
Msg-id 245.1136908673@sss.pgh.pa.us
Whole thread Raw
In response to Preventing access of user1 to user2's database  (Joao Miguel Ferreira <jmf@estg.ipvc.pt>)
List pgsql-novice
Joao Miguel Ferreira <jmf@estg.ipvc.pt> writes:
> I created 2 databases (user01db and user02db) owned by each of the
> users.
> Nevertheless, user02 can connect to the database of user01 (and
> vice-versa), create tables, select's, inserts, etc.

This is normal.  If you don't want a particular user to be able to
connect to a particular database at all, you should alter pg_hba.conf
to prevent it.  (As somebody suggested nearby, "sameuser" can be a
handy solution when your standard policy is that each user has a
database named after himself.)

As for what they can do after they've connected, the default behavior
is actually "not much" --- except that the "public" schema in each
database has public CREATE and USAGE permissions, so it's possible to
create tables within that schema.  If you prefer you can lock down
the public schema more, or even remove it altogether.  See the
discussion of privileges in the manual.

            regards, tom lane

pgsql-novice by date:

Previous
From: "Lane Van Ingen"
Date:
Subject: Error Returned by A Function
Next
From: "Lane Van Ingen"
Date:
Subject: Re: Error Returned by A Function