获取对xp_cmdshell的执行权限 [英] Getting execute permission to xp_cmdshell
问题描述
在尝试从存储过程中执行xp_cmdshell时,我看到一条错误消息。
xp_cmdshell 已启用。
对象xp_cmdshell上的EXECUTE权限被拒绝了
',数据库'mssqlsystemresource',模式'sys'问题的一部分是这是一个共享集群,我们在实例上有一个数据库,没有一个完整的管理权限。
不是sysadmin成员的用户角色在SQL Server实例上,您需要执行以下操作来授予对xp_cmdshell扩展存储过程的访问权限。此外,如果您忘记了列出将抛出的错误的步骤之一。
-
启用xp_cmdshell过程
消息15281,级别16,状态1,过程xp_cmdshell,行1
SQL Server阻止访问过程'sys.xp_cmdshell'组件'xp_cmdshell',因为此组件作为此服务器的安全配置的一部分被关闭。系统管理员可以通过使用sp_configure启用xp_cmdshell的使用。有关启用xp_cmdshell的详细信息,请参阅SQL Server联机丛书中的表面区域配置。
-
为具有对主数据库的公开访问权限的非系统管理员用户创建登录
状态5,过程xp_cmdshell,行1
对象'xp_cmdshell',数据库'mssqlsystemresource',模式'sys'上的EXECUTE权限被拒绝。*
-
对xp_cmdshell存储过程授予EXEC权限
,级别14,状态5,过程xp_cmdshell,第1行
对象'xp_cmdshell',数据库'mssqlsystemresource',模式'sys'上的EXECUTE权限被拒绝。*
b $ b
Msg 15153,级别16,状态1,过程xp_cmdshell,行1
无法检索xp_cmdshell代理帐户信息或无效。验证## xp_cmdshell_proxy_account ##凭据是否存在并包含有效信息。*
您的错误似乎是错过了第2步或第3步。我不熟悉集群,知道是否有任何特定的设置。
I am seeing an error message when trying to execute xp_cmdshell from within a stored procedure.
xp_cmdshell is enabled on the instance. And the execute permission was granted to my user, but I am still seeing the exception.
The EXECUTE permission was denied on the object ‘xp_cmdshell’, database ‘mssqlsystemresource’, schema ‘sys’
Part of the issue is that this is a shared cluster, and we have a single database on the instance, so we don't have a full range of admin permissions. So I can't go in and grant permissions, and what-not.
For users that are not members of the sysadmin role on the SQL Server instance you need to do the following actions to grant access to the xp_cmdshell extended stored procedure. In addition if you forgot one of the steps I have listed the error that will be thrown.
Enable the xp_cmdshell procedure
Msg 15281, Level 16, State 1, Procedure xp_cmdshell, Line 1 SQL Server blocked access to procedure 'sys.xp_cmdshell' of component 'xp_cmdshell' because this component is turned off as part of the security configuration for this server. A system administrator can enable the use of 'xp_cmdshell' by using sp_configure. For more information about enabling 'xp_cmdshell', see "Surface Area Configuration" in SQL Server Books Online.*
Create a login for the non-sysadmin user that has public access to the master database
Msg 229, Level 14, State 5, Procedure xp_cmdshell, Line 1 The EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.*
Grant EXEC permission on the xp_cmdshell stored procedure
Msg 229, Level 14, State 5, Procedure xp_cmdshell, Line 1 The EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.*
Create a proxy account that xp_cmdshell will be run under using sp_xp_cmdshell_proxy_account
Msg 15153, Level 16, State 1, Procedure xp_cmdshell, Line 1 The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information.*
It would seem from your error that either step 2 or 3 was missed. I am not familiar with clusters to know if there is anything particular to that setup.
这篇关于获取对xp_cmdshell的执行权限的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!