Skip to content

xp_cmdshell Proxy Account

EdVassie edited this page Jul 24, 2019 · 2 revisions
Previous SQL Server Proxy Accounts SQL Agent Job Proxy Accounts Next

The xp_cmdshell proxy is required to allow users without sysadmin rights to use the xp_cmdshell routine. The xp_cmdshell proxy account provides a set of Windows authorities that are used by xp_cmdshell in this situation.

If a user who has sysadmin authority uses xp_cmdshell, the Windows authorities granted to the SQL Server service account are used.

If an xp_cmdshell proxy has not been defined, then any use of xp_cmdshell by a user without sysadmin rights fails. This includes use of xp_cmdshell within SQL Agent jobs run using a SQL Agent job proxy. Even after the xp_cmdshell proxy has been defined, users must be granted Execute rights on xp_cmdshell before they can use it.

It is important that an account with low privileges is used for the xp_cmdshell proxy. If an account with high privileges is used, it is possible for a skilled user to exploit the xp_cmdshell proxy account authorities to grant equivalent authorities to another account. Never give the xp_cmdshell proxy account Windows local Administrator authority or SQL Server sysadmin authority.

The xp_cmdshell proxy account must be given read/execute rights on CMD.EXE in the Windows\System32 folder. Preferably this should be done using a GPO.

The following process will configure the xp_cmdshell proxy.

  1. Create the xp_cmdshell Windows account.

    Follow your site standards to get the proxy account created. Typically, the process takes about 2 days to complete, and often is requested via an email such as the example below.

    The supplied password should immediately be changed and recorded in the DBA Password Store. The password must comply with site security policy standards, and it is recommended that the password is at least 20 characters long and contains multiple examples of upper case, lower case, numeric and special characters.

    (In SQL Server 2000, only the first 15 characters of the password for a proxy are stored and used. This restriction has been removed for SQL Server 2005 and above.)

    Create Ticket

  2. Start SQL Server Management Studio (Start -> Programs -> Microsoft SQL Server -> SQL Server Management Studio). Connect to the instance using Object Explorer, then right-click on the Server and select Properties.

    The remaining processing in this section can also be performed by the sp_xp_cmdshell_proxy_account stored procedure.

    SSMS Instance Properties

  3. Select the Security page. Check Enable server proxy account and click on the ellipses button by the Proxy account field.

    CmdShell Proxy Enable

  4. Set the Location to the domain, enter the proxy account name as specified on the work request, and then click OK.

    CmdShell Account Select

  5. Enter the password for the proxy account, and then click OK.

    CmdShell Proxy Password

  6. A credential called ##xp_cmdshell_proxy_account## is automatically created. Management Studio can now be closed.

    Any non-sysadmin user that needs to use xp_cmdshell must be granted EXECUTE rights on xp_cmdshell.

If the password for a proxy needs to be changed, see Change Proxy Account Password.

Copyright FineBuild Team © 2012 - 2019. License and Acknowledgements

Previous SQL Server Proxy Accounts Top SQL Agent Job Proxy Accounts Next

Key SQL FineBuild Links:

SQL FineBuild supports:

  • All SQL Server versions from SQL 2019 through to SQL 2005
  • Clustered, Non-Clustered and Core implementations of server operating systems
  • Availability and Distributed Availability Groups
  • 64-bit and (where relevant) 32-bit versions of Windows

The following Windows versions are supported:

  • Windows 2022
  • Windows 11
  • Windows 2019
  • Windows 2016
  • Windows 10
  • Windows 2012 R2
  • Windows 8.1
  • Windows 2012
  • Windows 8
  • Windows 2008 R2
  • Windows 7
  • Windows 2008
  • Windows Vista
  • Windows 2003
  • Windows XP
Clone this wiki locally