Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

Allow SQL user to execute xp_cmdshell. Expand / Collapse
Author
Message
Posted Wednesday, June 17, 2009 4:25 PM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Thursday, December 12, 2013 6:35 AM
Points: 10, Visits: 304
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.
Post #737065
Posted Wednesday, June 17, 2009 8:13 PM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Yesterday @ 11:11 AM
Points: 5,366, Visits: 8,981
This link might help you find what you're looking for.

Wayne
Microsoft Certified Master: SQL Server 2008
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, How to ask a question, Performance Problems, Common date/time routines,
CROSS-TABS and PIVOT tables Part 1 & Part 2, Using APPLY Part 1 & Part 2, Splitting Delimited Strings
Post #737106
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse