Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 408
  • Last Modified:

"exec xp_cmdshell" write permissions problem

I'm running an "exec xp_cmdshell('c:\MyApp.exe')" command, and MyApp.exe writes an output file; however, I'm getting a permissions error.  What account do MS-SQL commands run as?  MyApp.exe runs fine manually from the command line.  I've tried everything, even giving "Everyone" full control doesn't work!
0
arichexe
Asked:
arichexe
1 Solution
 
nmcdermaidCommented:
My understanding is if your SQL server login is a sysadm, it runs under whatever the SQL Server service runs under (by default local system, which is useless for networked drives)

If the account is not a sysadm, it runs under the proxy account.

Directly from books online:


When xp_cmdshell is invoked by a user who is a member of the sysadmin fixed server role, xp_cmdshell will be executed under the security context in which the SQL Server service is running. When the user is not a member of the sysadmin group, xp_cmdshell will impersonate the SQL Server Agent proxy account, which is specified using xp_sqlagent_proxy_account. If the proxy account is not available, xp_cmdshell will fail. This is true only for Microsoft® Windows NT® 4.0 and Windows 2000



0
 
arichexeAuthor Commented:
I gave local "Users" full control and it works fine now.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now