executing xp_cmdshell with a sql login

  • [font="Verdana"]Hi Folks,

    I want to execute a storedprocedure which uses xp_cmdshell. The procedure will executed by sql users( SQL SERVER 2000,SP3, Windows and SQL authentication).

    When i execute, i get the following error message

    Msg 50001, Level 1, State 50001

    xp_cmdshell failed to execute because current security context is not sysadmin and proxy acount is not setup correctly. For more information, refer to Book Online, search for topic related to xp_sqlagent_proxy_account.

    After doing some googling, i added a proxyaccount using xp_sqlagent_proxy_account.

    Even now i am unable to run xp_cmdshell in the sql login. However i am able to run xp_cmdshell, when i log in to the sqlserver with the windows login account which i provided as proxy account.

    Is it really possible to execute xp_cmdshell with a sql login without server administrator privileges?

    Is somehow impersonation is possible in sql 2000?

    Please give your suggestions.[/font]

    Kindest Regards,
    Paarthasarathy
    Microsoft Certified Technology Specialist
    http://paarthasarathyk.blogspot.com

  • What is the error when you attempt to call xp_cmdshell as the SQL user?

    CEWII

  • As i told earlier.. this is the error

    Msg 50001, Level 1, State 50001

    xp_cmdshell failed to execute because current security context is not sysadmin and proxy acount is not setup correctly. For more information, refer to Book Online, search for topic related to xp_sqlagent_proxy_account.

    The statement i am trying to execute is as simple as

    xp_cmdshell dir

    Kindest Regards,
    Paarthasarathy
    Microsoft Certified Technology Specialist
    http://paarthasarathyk.blogspot.com

  • That is ringing some bells. If I remember correctly the proxy setup can be seen under the sql agent set, I'm guessing that although you HAVE set the account the flag indicating that non-sysadmin users can call it is not set, you should see that flag there.

    CEWII

  • Hi,

    I enabled the "Non sys-admin job step proxy account" in the sql server agent settings. Still it is failing, but with a different message.

    Msg 50001, Level 1, State 50001

    xp_cmdshell failed to execute because CreateProcessAsUserW returns error 1314. please make sure the service account SQL Server running under has appropriate privilege. For more information, search Book Online for topic related to xp_sqlagent_proxy_account

    Kindest Regards,
    Paarthasarathy
    Microsoft Certified Technology Specialist
    http://paarthasarathyk.blogspot.com

  • http://sqlforums.windowsitpro.com/web/forum/messageview.aspx?catid=63&threadid=44702&enterthread=y

    I take it that you granted the execute permissions as well to xp_cmdshell

    --------------------------------------------------------------------------------------
    [highlight]Recommended Articles on How to help us help you and[/highlight]
    [highlight]solve commonly asked questions[/highlight]

    Forum Etiquette: How to post data/code on a forum to get the best help by Jeff Moden[/url]
    Managing Transaction Logs by Gail Shaw[/url]
    How to post Performance problems by Gail Shaw[/url]
    Help, my database is corrupt. Now what? by Gail Shaw[/url]

  • Thanks a Ton!

    Adding the local administrator account as the proxy account resolved the issue.

    Kindest Regards,
    Paarthasarathy
    Microsoft Certified Technology Specialist
    http://paarthasarathyk.blogspot.com

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply