Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > What user is executing the SP to use xp_cmdshell

Reply
Thread Tools

What user is executing the SP to use xp_cmdshell

 
 
darrel
Guest
Posts: n/a
 
      03-02-2005
I have a simple Stored procedure that I'm using to call the command shell to
execut DTSRUN (which, in turn, calls a DTS package):

CREATE PROCEDURE updateDB AS
Exec master..xp_cmdshell
'DTSRUN my paramaters...'

I'm calling this procedure from an asp.net page. I'm getting the following
error:

An error has occured:System.Data.SqlClient.SqlException: EXECUTE permission
denied on object 'xp_cmdshell', database 'master', owner 'dbo'.

Obviously, it's a permissions issue. It looks like I need the DB admin to
set up a new user account that has permission to run the xp_cmdshell SP.
Does that sound about right? If so, how do I go about calling that procedure
from my procedure under that account name?

-Darrel


 
Reply With Quote
 
 
 
 
bruce barker
Guest
Posts: n/a
 
      03-02-2005
you are correct, xp_cmdshell can only be run by a sqlserver sysadmin. your
stored proc can not change its login, the caller of the proc must connect to
sqlserver under an account that has been added to sqlserver sysadmin group.

you might look at setting up the dts package under sqlagent, and having the
proc scedule a run of the job.

-- bruce (sqlwork.com)



"darrel" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
| I have a simple Stored procedure that I'm using to call the command shell
to
| execut DTSRUN (which, in turn, calls a DTS package):
|
| CREATE PROCEDURE updateDB AS
| Exec master..xp_cmdshell
| 'DTSRUN my paramaters...'
|
| I'm calling this procedure from an asp.net page. I'm getting the following
| error:
|
| An error has occured:System.Data.SqlClient.SqlException: EXECUTE
permission
| denied on object 'xp_cmdshell', database 'master', owner 'dbo'.
|
| Obviously, it's a permissions issue. It looks like I need the DB admin to
| set up a new user account that has permission to run the xp_cmdshell SP.
| Does that sound about right? If so, how do I go about calling that
procedure
| from my procedure under that account name?
|
| -Darrel
|
|


 
Reply With Quote
 
 
 
 
darrel
Guest
Posts: n/a
 
      03-02-2005
> you are correct, xp_cmdshell can only be run by a sqlserver sysadmin. your
> stored proc can not change its login, the caller of the proc must connect

to
> sqlserver under an account that has been added to sqlserver sysadmin

group.
>
> you might look at setting up the dts package under sqlagent, and having

the
> proc scedule a run of the job.


Thanks, Bruce.

What I ended up doing was having our DB Admin set up a user that had
permission to run both the DTS package and the XP_cmdshell procedure.

We hit a snag with an error 997 GetProxyAccount, so it looks like my admin
will now have to set up a proxy account for this...

-Darrel


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Asp.net 2.0 web user controls not executing !? Kris G ASP .Net 0 06-23-2006 07:25 AM
What user is Executing ReportDocument.Export() method? Lars Netzel ASP .Net 0 03-04-2005 08:56 AM
Executing a script created by the end user Craig Howard Python 2 01-17-2005 01:52 PM
Trying to Execute a file using exec master.dbo.xp_cmdshell, from ASP Me ASP General 3 11-30-2004 07:12 PM
asp.net xp_cmdshell m3ckon ASP .Net 2 09-30-2004 01:19 PM



Advertisments