Allow SQL user to execute xp_cmdshell.

  • Allow SQL user to execute xp_cmdshell.

    OS: MS Windows Server 2003 Standard SP2

    SQL: Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)

    Nov 24 2008 13:01:59

    Copyright (c) 1988-2005 Microsoft Corporation

    Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)

    This computer was standalone and the SQL user running all the jobs had the sysadmin role.

    Now the computer is joined to the domain and I have removed the sysadmin role. Among the many errors I am fixing is not being able to execute xp-cmdshell. Here is the command and the error:

    exec xp_cmdshell 'ver';

    Msg 229, Level 14, State 5, Procedure xp_cmdshell, Line 1

    The EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.

    I have successfully executed this command:

    EXEC sp_xp_cmdshell_proxy_account 'domain\user', 'password';

    I'm certain the user/password is correct because if I enter one of them wrong the command fails.

    The sa user is able to successfully execute xp_cmdshell

    Some web pages suggest that I need to modify the xp_cmdshell procedure to allow it to be executed by the sql user. However, I cannot find the procedure. Does this need to be done? Will someone please point me to the relevant manual page or web page that has detailed instructions on how to do it? Or maybe someone just knows the *secret* command to make this work and would be willing to send it to me. Is there a better method?

    This job builds some files and then FTPs them to another computer. Calling a DOS .bat file using xp_cmdshell is what fails.

  • This link might help you find what you're looking for.

    Wayne
    Microsoft Certified Master: SQL Server 2008
    Author - SQL Server T-SQL Recipes


    If you can't explain to another person how the code that you're copying from the internet works, then DON'T USE IT on a production system! After all, you will be the one supporting it!
    Links:
    For better assistance in answering your questions
    Performance Problems
    Common date/time routines
    Understanding and Using APPLY Part 1 & Part 2

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

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