hi Ken,
[quoted text, click to view] Ken Allen wrote:
> Where can I find information on how to limit access to a SQL Server
> Express database contents to specific ID/Password combinations?
SQL Server security is actually bases on a combination of 2 phases..
the 1st one, related to Login, is where a user provides a piece of
information (like username and pwd for a standard SQL Server authenticated
connection, or the sid of his/her underlying Windows account/group [even
certificated by a Domain Controller when available] for a trusted
connection)..
once the credential you provided has been validated you'll be granted access
to SQL Server and the connection is completed..
(
http://msdn2.microsoft.com/en-us/library/ms189751.aspx)
then you have to access the desired database(s), and here the 2nd phase
comes into play..
In order to achieve te desired result, as each SQL Server instance can host
multiple databases and you could required a certain degree of granularity in
database access, an "administrator" has to create a user object in each
database her/she wants the related login to be accessible (english?? :D),
mapping the login with a database user...
(
http://msdn2.microsoft.com/en-us/library/ms173463.aspx)
you can only access databases that you have users created for you in. The
user is then (not mandatory) granted the permissions necessary to do
required in the
database (GRANT SELECT/DELETE/EXEC etc)
The reason for this "duality" is that you may have different permissions
depending on which database you are accessing. For example you may have
permissions to create and drop tables and update any data in the "A"
database but only have read permissions for data in the "B" database. More,
you may not even be allowed to access the "C" database..
[quoted text, click to view] >How does one use this new schema layer to facilitate this?
the schema layer has been introduced to accomodate the ownership problems
related to prior SQL Server versions (2000 included)..
each database object requires a an owner, so you could create the Employees
table owned by yourself... everyone who need access to that table has to
reference is as [Ken].[Employee] ... what if you will be fired in the next
future (I hope this is not an option :D)? the dba in charge should remove
your login and database user from the system, but this can be done only
changing the ownership of the [Ken].[Employee] table to another owner...
this can be problematic as well, and could break existing application..
schemas drop this problem as you no longer create [Ken].[Employee] objects
but, say, [HumanResources].[Employee] (as in the AdventureWorks SQL Server
2005 database).. each schema still requires an owner, but you can easely
manage schema ownership to different db users, without breaking
application's code..
but you still are required to manage permission for each user (or grouping
users in related database role(s) and thus managing privileges at this
higher level, say all Accounting departments people will be member of the
Accounting database role you have to create
[
http://msdn2.microsoft.com/en-us/library/ms187936.aspx and
http://msdn2.microsoft.com/en-us/library/ms187750.aspx] )
each database has a "Guest" database user, member of the "Public" database
role; when you access a database without a defined login-user mapping you'll
be subclassed to that user... I do personally disable that database user in
the Model database so that every new database that will be created will not
include this "feature" and preventing unauthorized access via the Guest user
(even if Public role permissions are very very low)..
[quoted text, click to view] > Right now any valid Windows user seems to be able to connect to and
> read the contents of a SQL Server Express database that I create, and
> I do not wish this to be the case. I would like to define two (2) user
> identifiers: one that can 'own' the database/schema, and the other
> that can read/update the data contents.
this is possible only if your instance includes the BUILTIN\Users Windows
group (for trusted connections)..
then you can modify your database with 2 separated database roles, one for
each of your requirements..
--
Andrea Montanari (Microsoft MVP - SQL Server)
http://www.asql.biz/DbaMgr.shtm http://italy.mvps.org DbaMgr2k ver 0.16.0 - DbaMgr ver 0.61.0
(my vb6+sql-dmo little try to provide MS MSDE 1.0 and MSDE 2000 a visual
interface)
--------- remove DMO to reply