By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,967 Members | 1,710 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,967 IT Pros & Developers. It's quick & easy.

how to restrict a user from accessing a specific database?

P: 61
when I create a user "user1" and give this user the permissions on a database "db1" (including login privilage), this user can access all databases although it doesn't have the privilges (even after implmenting the revoke command).
on the other hand, any user can access the database "db1"
after login, although I make (revoke all on database db1 from public ).

I need to restrict role "user1" to access only db1 and db2's sch_a and shc_f, and also don't show the other schemas in the same database. When listing databases, just two schemas should be shown (sch_a , sch_f).
Sep 28 '10 #1
Share this Question
Share on Google+
2 Replies


100+
P: 332
It could be a problem in your pg_hba.conf file
http://developer.postgresql.org/pgdo...-hba-conf.html. See the database paragraph.
Sep 28 '10 #2

Expert 100+
P: 700
For database you can use
Expand|Select|Wrap|Line Numbers
  1. revoke connect on <database> from <username>;
  2. revoke connect on <database> from public;
  3.  
for schemas revoke USAGE and CREATE privilege.

See here http://www.postgresql.org/docs/curre...ql-revoke.html
Sep 28 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.