禁用xp_cmdshell
代码---启用
-- To allow advanced options to be changed.
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
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
exec master..xp_cmdshell 'dir *.exe'
go
---------------禁用
-- To allow advanced options to be changed.
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', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
sp_configure 'xp_cmdshell'
对某个配置选项运行 RECONFIGURE 后,可通过执行 sp_configure 'option_name' 来查看是否已动态更新了该选项。对于动态更新的选项而言,run_value 列和 config_value 列的值应匹配。还可以通过查看 sys.configurations 目录视图的 is_dynamic 列来确定哪些选项是动态的。
select is_dynamic,* from sys.configurations where [name]='xp_cmdshell'
-- To allow advanced options to be changed.
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
EXEC sp_configure 'xp_cmdshell', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
exec master..xp_cmdshell 'dir *.exe'
go
---------------禁用
-- To allow advanced options to be changed.
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', 0
GO
-- To update the currently configured value for this feature.
RECONFIGURE
GO
sp_configure 'xp_cmdshell'
对某个配置选项运行 RECONFIGURE 后,可通过执行 sp_configure 'option_name' 来查看是否已动态更新了该选项。对于动态更新的选项而言,run_value 列和 config_value 列的值应匹配。还可以通过查看 sys.configurations 目录视图的 is_dynamic 列来确定哪些选项是动态的。
select is_dynamic,* from sys.configurations where [name]='xp_cmdshell'

浙公网安备 33010602011771号