A Call To Createprocessasuser Failed With Error Code
Contents |
(Русский)ישראל (עברית)المملكة العربية السعودية (العربية)ไทย (ไทย)대한민국 (한국어)中华人民共和国 (中文)台灣 (中文)日本 (日本語) HomeLibraryLearnDownloadsTroubleshootingCommunityForums Ask a question Quick access Forums home Browse forums users FAQ Search related threads Remove From My Forums Asked by: Msg 15121, Level 16, State 10, XP_Cmdshell - A call to 'CreateProcessAsUser' failed with error code: '1314'. SQL Server an error occurred during the execution of sp_xp_cmdshell_proxy_account > SQL Server Security Question 0 Sign in to vote I have the XP_cmdshell xp_cmdshell proxy account information issues for the past two days in SQL2005 SP2 environment. There is a domain account with sysadmin privilege. I have created a grant exec permission on the xp_cmdshell stored procedure proxy account and gave the execute privilege for xp_cmdshell. If i try to run the following commmand EXEC master..xp_cmdshell 'dir *.txt' Msg 15121, Level 16, State 10, Procedure xp_cmdshell, Line 1 An error occurred during
The Execute Permission Was Denied On The Object 'xp_cmdshell' Database 'mssqlsystemresource'
the execution of xp_cmdshell. A call to 'CreateProcessAsUser' failed with error code: '1314'. But if i give sysadmin priv and then i try to execute. It worked. I cant give sysadmin priv so i m using a proxy account. Whether any one have solution for it. Wednesday, July 28, 2010 9:07 AM Reply | Quote All replies 0 Sign in to vote Hi, This is beacuse the service account under xp_cmdshell permissions sql server 2012 which SQL server is running does not have proper permissions. You can try changing service account from "SQL Server Configuration Manager". To check for tesing perpose, set any machine administrator as service user and restart the service. After checking revert back to current user. If xm_cmdshell works with Administrator as service user, add current service user to proper windows group. For reference you can visit this link. -Chintak. Wednesday, July 28, 2010 10:36 AM Reply | Quote 0 Sign in to vote Hi, We have done the same things. Still we are receiving the error. Venkat Wednesday, July 28, 2010 12:25 PM Reply | Quote 0 Sign in to vote Can you confirm that the service account is a member of SQLServer2005MSSQLUser$
inspired from a newsgroup discussion. The question basically is:What do you need to do in order to use xp_cmdshell? Note that there grant execute on xp_cmdshell are obvious security implications of doing this. (I'm not recommending usage of xp_cmdshell
A Call To Logonuserw Failed With Error Code 1385
in general, this is a technical blog post!) We first need to think about what happens here, from an architectural
Xp_cmdshell Permissions Sql Server 2008 R2
level: Somebody who has logged in to SQL Server executes xp_cmdshell. For this, SQL Server need to spawn a process in Windows. A process in Windows need to execute in a Windows https://social.msdn.microsoft.com/Forums/sqlserver/en-US/ec4f7586-3f58-43cf-bfc7-8b0438471449/msg-15121-level-16-state-10-xpcmdshell-a-call-to-createprocessasuser-failed-with-error-code?forum=sqlsecurity user account. So, what Windows account is used? If the SQL Server login who is executing xp_cmdshell is sysadmin, then SQL Server will use the service account (it will not "pretend to be somebody else"). But if the login isn't sysadmin, then we need to configure what Windows account to be used (using sp_xp_cmdshell_proxy_account). Note that this configuration is the same for all non-sysadmins! But http://sqlblog.com/blogs/tibor_karaszi/archive/2007/08/23/xp-cmdshell-and-permissions.aspx there's a little bit more to it. Below is an outline of what need to be done. Step 2 and 3 are only needed if the one who is to execute xp_cmdshell isn't sysadmin. Note that the steps don't have to be performed in the order listed below. We need to allow usage of xp_cmdshell in general (on 2005). Use "Surface Area Configuration" or sp_configure for this. We need to have a user in the master database which has execute permission on xp_cmdshell. If you are uncertain about the difference between logins and users, you should read up about it in BOL. We need to say what Windows account should be used when a non-sysadmin user is executing xp_cmdshell. So, here's the TSQL script that does all above: --1, allow xp_cmdshellEXEC sp_configure 'xp_cmdshell', 1RECONFIGUREGO --2, grant permission to xp_cmdshellUSE masterCREATE LOGIN JohnDoe WITH PASSWORD = 'jlkw#.6(' --Note, we are in the master database!!!CREATE USER JohnDoe FROM LOGIN JohnDoe --Run as login xEXECUTE AS login = 'JohnDoe'--Below fails, no execute permission on xp_cmdshellEXEC xp_cmdshell 'DIR C:\*.*'REVERTGO --Note, we are in the master database!!!GRANT EXECUTE ON xp_cmdshell TO JohnDoe --Try againEXECUTE AS login = 'JohnDoe'--Ex
RESOURCES Database Tools SQL Scripts & Samples Links » Database Forum » Slideshows » Sitemap Free Newsletters: http://www.databasejournal.com/features/mssql/xpcmdshell-for-non-system-admin-individuals.html DatabaseDaily News Via RSS Feed Database Journal |DBA Support |SQLCourse |SQLCourse2 Featured Database Articles MS SQL Posted June 3, 2013 xp_cmdshell for Non-System Admin Individuals By http://www.sadikhov.com/forum/index.php/topic/152655-error-with-xp-cmdshell-sql2005/ Greg Larsen There is a system extended store procedure called “xp_cmdshell” that can be used to issue shell commands using TSQL code. Being able to do a call this can be quite useful for a number of different situations. But when SQL Server is first installed out of the box this extended stored procedure is not enabled. Additionally once you enable it the default behaviors is that it is only available to the logins that have System Admin permissions. There may be a call to times when you want to allow non-System Admin logins to be able to execute the xp_cmdshell extended stored procedure. In this article I will show you how to setup xp_cmdshell so non-System Admins can use this extended stored procedure. Enabling xp_cmdshell Out of the box xp_cmdshell is disabled. If you want to use xp_cmdshell you need to enable it. There are a number of ways to enable xp_cmdshell. One of the ways to enable xp_cmdshell is to use the “sp_configure” extended stored procedure using the following TSQL code: EXEC sp_configure 'show advanced options', 1 GO RECONFIGURE GO EXEC sp_configure 'xp_cmdshell', 1 GO RECONFIGURE GO Another way to enable xp_cmdshell is to use Policy Based Management. For more information on this method review Books Online documentation. Default Security Rights for xp_cmdshell Operations When you first enable xp_cmdshell it can only be executed by members of the “sysadmin” server role. Additionally when the xp_cmdshell process executes it spawns a Windows process that
have javascript disabled. Several functions may not work. Please re-enable javascript to access full functionality. 0 Error with xp_cmdshell SQL2005 Started by giom , Jan 23 2009 11:19 PM Please log in to reply 1 reply to this topic #1 giom giom Newbie Members 28 posts Posted 23 January 2009 - 11:19 PM Hi everyone, I had an issue on SQL 2005 Sp2, and never found a fix from all kinds the forums, the issue is only domain admin or SQL sysadmin are able to execute xp_cmdshell command via TSQL the execution of xp_cmdshell works fine using SQL sysadmin user or windows domain admin which has just simple public right in SQL First, xp_cmdshell command is enable on the server(I enabled it manually) Second, user I'm using for doing it, it is an sql user who has access to Master DB and have execute rights on xp_cmdshell procedure. Here there are the details of the different test I've made: SELECT SERVERPROPERTY('ProductVersion') SQL Server 2005 Service Pack 2 2005.90.3042 So. here the steps I did in order to make sure everything is setting fine. 1. Grant Execute permission to user who will call xp_cmdshell grant user db_owner to master database GRANT EXECUTE ON xp_cmdshell TO [user] 2. Create a proxy credential for xp_cmdshell. EXEC sp_xp_cmdshell_proxy_account 'user', 'pw'; (I Made sure the user has sysadmin permission) Error messages I got when I tested with exec master..xp_cmdshell 'dir' 1. Message after execute granted to user, but proxy credential not created Msg 15153, Level 16, State 1, Procedure xp_cmdshell, Line 1 The xp_cmdshell proxy account information cannot be retrieved or is invalid. Verify that the '##xp_cmdshell_proxy_account##' credential exists and contains valid information. Resolved with Step 2 above 2. Message when user does not have access to master database or when no access to xp_cmdshell command Msg 229, Level 14, State 5, Procedure xp_cmdshell, Line 1 EXECUTE permission denied on object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'. Resolved withStep 1 above Now I've got this error message when both above are done (proxy created with user who has sysadmin) and (permission granted to user calling xp_cmdshell ) Msg 15121, Level 16, State 10, Procedure xp_cmdshell, Line 1 An error occurred during the execution of xp_cmdshell. A call to 'CreateProcessAsUser' failed with error code: '1314'. I Hope someone could help me. Thanks in advance. Bye. 0 Back to top #2 djbabu djbabu Newbie Members 3 posts Posted 21 March 2009 - 0