SQL Clone
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


Allow SQL user to execute xp_cmdshell.


Allow SQL user to execute xp_cmdshell.

Author
Message
Richard-760904
Richard-760904
Grasshopper
Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)Grasshopper (10 reputation)

Group: General Forum Members
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.
WayneS
WayneS
SSCrazy Eights
SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)SSCrazy Eights (9.7K reputation)

Group: General Forum Members
Points: 9719 Visits: 10568
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, 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

Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search