zoukankan      html  css  js  c++  java
  • 【转】SQL Server 2005如何起用“xp_cmdshell”

    xp_cmdshell 扩展存储过程将命令字符串作为操作系统命令 shell 执行,并以文本行的形式返回所有输出。由于xp_cmdshell 可以执行任何操作系统命令,所以一旦SQL Server管理员帐号(如sa)被攻破,那么攻击者就可以利用xp_cmdshell 在SQL Server中执行操作系统命令,如:创建系统管理员,也就意味着系统的最高权限已在别人的掌控之中。由于存在安全隐患,所以在SQL Server 2005中, xp_cmdshell 默认是关闭的。 

      两种方式启用xp_cmdshell 

      1.打开外围应用配置器—> 

      功能的外围应用配置器—> 

      实例名Database Enginexp_cmdshell—> 

      启用 

      2.sp_configure 

      -- 允许配置高级选项 

      EXEC sp_configure 'show advanced options', 1 

      GO 

      -- 重新配置 

      RECONFIGURE 

      GO 

      -- 启用xp_cmdshell 

      EXEC sp_configure 'xp_cmdshell', 0 

      GO 

      --重新配置 

      RECONFIGURE 

      GO 

      --执行想要的xp_cmdshell语句 

      Exec xp_cmdshell 'query user' 

      GO 

      --用完后,要记得将xp_cmdshell禁用(从安全角度安全考虑) 

      -- 允许配置高级选项 

      EXEC sp_configure 'show advanced options', 1 

      GO 

      -- 重新配置 

      RECONFIGURE 

      GO 

      -- 禁用xp_cmdshell 

      EXEC sp_configure 'xp_cmdshell', 1 

      GO 

      --重新配置 

      RECONFIGURE 

      GO 
  • 相关阅读:
    mongodb安装与启动
    js数组操作
    js字符串操作
    js原型对象和原型链
    Js 原型对象与原型链
    zepto
    闭包的理解
    JSON与XML的区别比较
    ajax 异步请求四个步骤
    angularJS之项目知识
  • 原文地址:https://www.cnblogs.com/abinxm/p/2225167.html
Copyright © 2011-2022 走看看