Limit the list of databases with SQL Server permissions

By default, if you connect to a remote SQL Server through an account that has access to say 1 out of 10 databases. You will still see all other databases in the Object Explorer, obviously due to permissions that you cannot request them, but you can see their names.

I heard that there is a method that disables this behavior, but I could not find the answer, does anyone know how to do this? To give an example, I have a SQL Server called MyDbServer, it has 4 databases,

  • Mydatabase
  • Yourdatabse
  • Private database
  • ReallyPrivateDb

If you connect through an account that has only permissions for "YourDatabse", you will still see a list of all other databases, query attempts will provide permission to "choose" or a similar error.

For security systems, we DO NOT want users to see any database other than the ones they were mapped to.

+4
source share
3 answers

This blog post discusses database hiding techniques for SQL 2000 and SQL 2005.

+1
source

After my client ran into identified resources, I did some testing and created this blog post with a bit more context and instructions on how it would work.

+1
source

In short:

use master go deny VIEW any DATABASE to login1 go 

where login1 is the account you want to restrict.

0
source

Source: https://habr.com/ru/post/1277733/


All Articles