Re: Controlling Access to data from multiple databases



Cqlboy (Cqlboy@xxxxxxxxxxxxxxxxxxxxxxxxx) writes:
How do I control data access to several databases for a targeted Windows
Group? I created a stored procedure and granted "Execute" permissions but
this doesn't work since within the body of the stored procedure it reaches
out to read tables in other databases which, in turn, is why my stored
procedure fails on permissions. I can only solve the problem by granting
read only permission to all databases my stored procedure depends on. I
thought I only had to give permission to my stored procedure, not every
object it depends on? Thanks. -CqlBoy

For this to work, you need to 1) enable db-chaining 2) make sure that
the databases have the same owner. By default cross db-chaining is turned
off, as it is not a secure on a server where different people own
different databases, and typically do have access to each other's databases.
On the other hand, on a server where the DBA is control over all databases,
enabling DB-chaning is not a risk.

I have some details on http://www.sommarskog.se/grantperm.html#dbchainging
(which is part of a longer article).

--
Erland Sommarskog, SQL Server MVP, esquel@xxxxxxxxxxxxx

Links for SQL Server Books Online:
SQL 2008: http://msdn.microsoft.com/en-us/sqlserver/cc514207.aspx
SQL 2005: http://msdn.microsoft.com/en-us/sqlserver/bb895970.aspx
SQL 2000: http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

.



Relevant Pages

  • Re: RETURN_VALUES ??? done... What have I gained?
    ... Dr Codd is the IBM guy who theorized and developed everything we know about ... SQL and relational databases. ... >> dataset even though you are pointing to a stored procedure. ...
    (borland.public.delphi.database.ado)
  • Re: object level permissions being lost when migrating
    ... I am talking about SQL Logins, ... can go to the object and see that user X has permissions XYZ on that object, ... I then restored the databases and re-synched the users via the ...
    (microsoft.public.sqlserver.security)
  • Re: one SQL DB getting info from another - user setup?
    ... It appears from your narrative that the Main and DB1 databases ... EXEC sp_helpdb 'Main' ... SQL 2000 SP3 and is turned off by default. ... > In the permissions for Main, USER1 and USER2 are listed, but have NO ...
    (microsoft.public.sqlserver.security)
  • Re: Permissions and ODBC
    ... objects have the same owner. ... case of dbo-owned objects in different databases, ... See the SQL 2003 SP3 Books Online for more ... > The Ms Access program executes a stored procedure that resides in SQL ...
    (microsoft.public.sqlserver.server)
  • Re: SQL Injection Prevention
    ... I'm just saying that when it concerns to SQL injection, ... > built stored procedure so it's obvious which will win. ... > suggest you stay away from databases altogether:). ...
    (microsoft.public.sqlserver.server)