Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Executing xp_cmdshell with non sys admin privilege

Author  Topic 

vyelchri
Starting Member

12 Posts

Posted - 2009-06-01 : 10:19:38
I have an SP which is being used by xp_cmdshell. i have given EXEC previlege on this extended stored procedure to the non sysdba account.

when i tried to execute xp_cmdshell (exec xp_cmdshell 'copy c:\vb c:\vbs') with non sysdba account, i am getting the following error message

xpsql.cpp: Error 1314 from CreateProcessAsUser on line 636
Msg 50001, Level 1, State 0

can somebody plz help me?

is there a method to copy files from one location to another location for non sysdba accounts with out using xp_cmdshell?


Thanks,
VB

mcrowley
Aged Yak Warrior

771 Posts

Posted - 2009-06-02 : 10:59:39
When you use EXEC, you are effectively spawning a new process. Chain of ownership does not apply anymore. As such, you would have to grant permissions on xp_cmdshell, which is a very bad idea.

A better way would be to set up a SQL Agent job to move the files around. The stored procedure can trigger this job, but there will have to be some logic around making sure that no one tries to fire off this job when it is still running. Also, if different files are to be moved each time, then you will have to do a bunch of work around that, as well.
Go to Top of Page
   

- Advertisement -