?
Solved

"exec xp_cmdshell" write permissions problem

Posted on 2005-04-04
2
Medium Priority
?
403 Views
Last Modified: 2009-07-29
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
Comment
Question by:arichexe
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 30

Accepted Solution

by:
nmcdermaid earned 500 total points
ID: 13704296
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
 

Author Comment

by:arichexe
ID: 13704411
I gave local "Users" full control and it works fine now.
0

Featured Post

Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
In part one, we reviewed the prerequisites required for installing SQL Server vNext. In this part we will explore how to install Microsoft's SQL Server on Ubuntu 16.04.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question