Sql server SQL Server中的xp\u cmdshell访问
我从一位同事那里继承了一个存储过程,该同事在存储过程中使用了xp_cmdshell。为了为特定登录启用此功能,我需要运行以下命令来启用它Sql server SQL Server中的xp\u cmdshell访问,sql-server,stored-procedures,Sql Server,Stored Procedures,我从一位同事那里继承了一个存储过程,该同事在存储过程中使用了xp_cmdshell。为了为特定登录启用此功能,我需要运行以下命令来启用它 EXEC sp_configure 'show advanced options', 1 GO -- To update the currently configured value for advanced options. RECONFIGURE GO -- To enable the feature. EXEC sp_configure 'xp_cmds
EXEC sp_configure 'show advanced options', 1
GO
-- To update the currently configured value for advanced options.
RECONFIGURE
GO
-- To enable the feature.
EXEC sp_configure 'xp_cmdshell', 1
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
我已经将sysadmin服务器角色访问权添加到这个特定的登录名中,到目前为止,运行这个存储过程需要sysadmin访问权
我们已授予该特定用户在开发SQL Server中的sysadmin访问权限。当我们将存储过程迁移到生产环境时,DBA担心该用户在生产环境中有太多特权
在生产环境中,是否有任何方法可以通过此登录继续运行存储过程,而无需sysadmin访问权限
提前感谢您的帮助。谢谢您的帮助。我在这里继续评论,因为我需要为示例代码添加标记 存储过程尝试执行基本文件IO操作,以将文件移动、复制或删除到网络驱动器
e.g. exec @ret_val = master..xp_cmdshell @stmt, no_output @stmt
@stmt can be "copy //hostname/mapdrive/subdirectory/somefile //hostname/mapped directory" using sharing mechanism.
or create a subdirectory.
e.g. select @stmt = 'md '+@pri_path
我相信它们使用存储过程来执行此操作,因此它们可以在存储过程中包含所有文件I/O操作
至于xp_cmd_shell_proxy_帐户,我发现了这个。根据我的解释,我们向sql server提供windows登录用户名和密码,以获得对shell的访问。我说得对吗
谢谢 搜索xp\u cmdshell代理帐户。您需要准确解释存储过程需要xp\u cmdshell的功能,或者首先解释为什么必须在SQL Server中执行此操作。通常,有更好的方法。谢谢你的帮助。存储过程尝试执行基本文件IO操作,以将文件移动、复制或删除到网络驱动器。