2016-03-02 78 views
1

如何才能看到'sa'登錄連接登錄,只有授予閱讀一些意見?可能不能編輯任何東西,但可以看到。也可以看到數據庫列表,但無法打開。全部在SQL Management Studio中。登錄創建者:爲什麼無權登錄可以看到'sa'登錄?

create login YourTpvLogin with password = 'enter new password here' 
go 

create user YourTpvUser for login YourTpvLogin 
go 

grant select on YourView to YourTpvUser 

謝謝你的解釋或如何解決它的方法。

+0

你能解釋一下你在這裏問什麼嗎?我根本沒有跟隨你。 –

+0

「看」什麼方式?在sa登錄名在SSMS登錄列表中?是否承認您認爲sa登錄存在安全風險? –

回答

2

好吧......所有Every SQL Server login belongs to the public server role.接下來首先 - The public server role is granted VIEW ANY DATABASE permission這意味着包括master數據庫這反過來records all the system-level information for a SQL Server system包括有關SQL Server登錄和信息sa登錄當然也不例外a login that is granted this permission can see metadata that describes all databases

因此...任何新的登錄名都可以看到所有數據庫和登錄名,但無法修改它們。

隱藏數據庫的可能「解決方案」是deny a login the VIEW ANY DATABASE permission

要限制數據庫元數據的可見性,請拒絕登錄VIEW ANY DATABASE權限。在拒絕此權限後,登錄名僅可以看到 只有登錄擁有的master,tempdb和數據庫的元數據。

而且......你不能完全隱藏sa登錄,因爲每次登錄都必須能夠從master數據庫中讀取服務器的元數據。

+0

非常感謝。很好的解釋。 – user181685

相關問題