在 SQL Server 2008 中限制对特定 Windows 组的数据库访问
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1948920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Restricting database access to specific Windows groups in SQL Server 2008
提问by
I'm trying to restrict access to a database on my server to only allow users from a specific Windows group.
我试图限制对我服务器上的数据库的访问,以只允许来自特定 Windows 组的用户。
I have enabled Windows authentication for the server, but it seems as if I can only allow access to specific users, not specific groups...
我已经为服务器启用了 Windows 身份验证,但似乎我只能允许访问特定用户,而不是特定组......
Is there any way I can do this?
有什么办法可以做到这一点吗?
Most of the resources I've found contain SQL Server 2005
specific instructions, and I have thus far been unable to translate them over to 2008
.
我发现的大多数资源都包含SQL Server 2005
特定说明,到目前为止我无法将它们转换为2008
.
采纳答案by NotMe
Do the following:
请执行下列操作:
In the New user Dialog click the Search button
.
Then click Object Types
.
Select Groups
, deselect Users
and Built-in Security Principals
Click Ok
.
Then click on Find Now
在新用户对话框中单击Search button
。
然后点击Object Types
。
选择Groups
、取消选择Users
并Built-in Security Principals
单击Ok
。
然后点击Find Now
At this point you should see a list of groups available.
Pick the one you want and click OK
.
此时,您应该会看到一个可用组列表。
选择您想要的一个并单击OK
。
Assign rights as necessary.
根据需要分配权利。
回答by gbn
SQL Server 2005 and 2008 are essentially the same here.
SQL Server 2005 和 2008 在这里基本相同。
USE master
CREATE LOGIN [domain\group] FROM WINDOWS
GRANT CONNECT SQL TO [domain\group]
USE MyDB
CREATE USER [domain\group] FROM LOGIN [domain\group]
GRANT CONNECT TO [domain\group]
This will allow everyone in the windows group to connect to your database. Is that what you want?
这将允许 windows 组中的每个人都连接到您的数据库。那是你要的吗?
Or do you want to deny some folk access, which I thought at first...
或者你想拒绝一些民间访问,我一开始以为......