SQL Server 2005如何起用 xp_cmdshell
xp_cmdshell 擴展存儲過程將命令字符串作為操作系統(tǒng)命令 shell 執(zhí)行,并以文本行的形式返回所有輸出。由于xp_cmdshell 可以執(zhí)行任何操作系統(tǒng)命令,所以一旦SQL Server管理員帳號(如sa)被攻破,那么攻擊者就可以利用xp_cmdshell 在SQL Server中執(zhí)行操作系統(tǒng)命令,如:創(chuàng)建系統(tǒng)管理員,也就意味著系統(tǒng)的最高權(quán)限已在別人的掌控之中。由于存在安全隱患,所以在SQL Server 2005中,xp_cmdshell 默認是關(guān)閉的。
兩種方式啟用xp_cmdshell
1、打開外圍應(yīng)用配置器—>
功能的外圍應(yīng)用配置器—>
實例名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 --執(zhí)行想要的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 |
總結(jié)
以上是生活随笔為你收集整理的SQL Server 2005如何起用 xp_cmdshell的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 查看SecureCRT保存的密码
- 下一篇: PHP访问MySQL数据库