Access Denied issue when exec xp_cmdshell on a UNC pathname
Mar 28th, 2007 by Onyrix 710 Views |
Email This Post
|
Print This Post
Suppose you use a Sql Server user to execute a shell command on a remote shared folder
and you get an Access Denied error.
exec xp_cmdshell ‘command UNC path’
This is because MSSQLSERVER, SQLSERVERAGENT services run as Local System Account that is not recognized on the remote machine you are pointing by the UNC path.
Solution:
- go to Control Panel, Administrative Tools, Services
- stop MSSQLSERVER and SQLSERVERAGENT
- change Logon as user from local system to This User, specifying an administrative account that is the same on the two machine and with the same password (be aware changing it).
- start MSSQLSERVER and SQLSERVERAGENT
- give privileges to that account to the remote shared folder
- retry the exec xp_cmdshell

del.icio.us
Digg
Furl
Reddit
Technorati