MS SQL xp_cmdshell permission error
April 6th, 2007 — ¥ong¥s
Do you ever get Access denied error when using MS SQL xp_cmdshell command?
E.g. I have an special AD account access to \\server2\backups folder. In my Store Procedure, I have to copy db.bak from local folder to share folder.
EXEC xp_cmdshell ‘copy c:\SQLbcks\db.bak \\server2\backups\db.bak, NO_OUTPUT’;
I get access denied error because xp_cmdshell use permission associate with SQL server service account (local system account). I have to change the SQL service account to use the AD account in order xp_cmdshell able to use the correct permission. This seems a bit weired. Do we have other solutions?


