Select the product you need help with
How to enable non-sysadmin accounts to execute the "xp_cmdshell" extended stored procedure in SQL Server 2000Article ID: 890775 - View products that this article applies to. On This PageSUMMARYThis article describes how to configure a Microsoft Windows-level SQL
Server Agent proxy account to be used by SQL logins that are not members of the
sysadmin fixed server role. Additionally, the article contains references
to more information to help you solve problems that may occur when you try to
set up a proxy account. INTRODUCTIONThe xp_cmdshell extended stored procedure invokes a Windows command shell from
within Microsoft SQL Server 2000. When the xp_cmdshell extended stored procedure is executed by a member of the sysadmin fixed server role, the Windows process of the command shell runs
with the security context of the Windows service account of SQL Server. For
example, if SQL Server is running under a Windows logon that has administrative
rights on the computer, the user who opens a command prompt with the xp_cmdshell extended stored procedure will receive access to Windows as a
local administrator. By default, the permission to execute the xp_cmdshell extended stored procedure is granted only to members of the sysadmin fixed server role. This permission helps deter the escalation of
rights. When you want to start new Windows processes with a reduced level of rights, you can use the SQL Server Agent proxy account to configure a Windows account with the appropriate level of rights. MORE INFORMATIONWhen you try to execute the xp_cmdshell extended stored procedure from a SQL Server login that is not a
member of the sysadmin server role and the SQL Server Agent proxy account has not been
set up correctly, you may receive error messages that are similar to the
following: Msg 50001, Level 1, State 50001 xpsql.cpp: Error 997 from GetProxyAccount on line 499 Msg
50001, Level 1, State 50001 xpsql.cpp: Error 317 from GetProxyAccount on line 499 Msg 50001, Level 1, State 50001
xpsql.cpp: Error 0 from GetProxyAccount on line 499 Msg 50001, Level 1, State 50001 xpsql.cpp: Error 87 from GetProxyAccount on line 499 To configure a proxy account for SQL Server logins that are not members of the sysadmin fixed server role, use one of the following methods. Method 1: Use SQL Server Enterprise ManagerConfigure the Windows accountTo set the Windows account to enable non-sysadmin users to execute the xp_cmdshell extended stored procedure, follow these steps:
Add a SQL Server login accountTo add a SQL Server login account that you want to grant permissions to execute the xp_cmdshell extended stored procedure, follow these steps:
Method 2: Run a Transact-SQL scriptRun the following Transact-SQL script to enable the Windows account to execute the xp_cmdshell extended stored procedure:To add the SQL Server login account that you want to grant permission to execute the xp_cmdshell extended stored procedure, run the following Transact-SQL script: Note The proxy account is the Windows account in whose security context the SQL Server Agent jobs or command-line commands are run. When you set up the Windows account for the SQL Server Agent proxy account, you must give the account the Windows-level "Log on as a batch job" user right. REFERENCESFor more information about the xp_cmdshell extended stored procedure, see the "Transact-SQL Reference" topic
in SQL Server Books Online. For more information about the SQL Server Agent proxy account, visit the following Microsoft Developer Network (MSDN) Web sites: xp_sqlagent_proxy_account
For more information about how to set appropriate permissions on the
proxy account, click the following article number to view the article in the Microsoft Knowledge Base:
http://msdn2.microsoft.com/en-us/library/aa260700(SQL.80).aspx
(http://msdn2.microsoft.com/en-us/library/aa260700(SQL.80).aspx)
xp_cmdshell http://msdn2.microsoft.com/en-us/library/aa369561.aspx
(http://msdn2.microsoft.com/en-us/library/aa369561.aspx)
Setting up Windows Services Accounts http://msdn2.microsoft.com/en-us/library/aa176564(SQL.80).aspx
(http://msdn2.microsoft.com/en-us/library/aa176564(SQL.80).aspx)
283811
(http://support.microsoft.com/kb/283811/
)
How to change the SQL Server or SQL Server Agent service account without using SQL Enterprise Manager in SQL Server 2000 or SQL Server Configuration Manager in SQL Server 2005
PropertiesArticle ID: 890775 - Last Review: June 2, 2008 - Revision: 3.2
|


Back to the top








