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 
  • 相关阅读:
    Jenkins构建项目
    jenkins的理解及安装
    GitLab初识以及代码迁移
    深入浅出Git(偏向理论)
    理解下所谓的ssh隧道
    洛谷-P1908 逆序对
    洛谷-P1010 幂次方
    洛谷-P1226 【模板】快速幂||取余运算
    洛谷-P1074 靶形数独
    洛谷-P1433 吃奶酪
  • 原文地址:https://www.cnblogs.com/abinxm/p/2225167.html
Copyright © 2011-2022 走看看