Quantcast
Channel: SQL Server Database Engine forum
Viewing all articles
Browse latest Browse all 12963

I am confused as to how to set up a proxy to allow a non-sysadmin login to execute xp_cmdshell

$
0
0

In SQL Server 2012, to allow a non-sysadmin login to execute xp_cmdshell, must the user account be a Windows Domain account?  In other words can a SQL Server account be used?

I found these instructions for SQL Server 2005 and 2008.  Can they be used for SQL Server 2012?  Is PowerDomain\PowerUser an Active Domain account?


USE master
GO
-- Create a test login called XPCmdshellUser
CREATE LOGIN XPCmdshellUser WITH PASSWORD='P3h4jek@x'
-- Create a proxy credential for xp_cmdshell.
EXEC sp_xp_cmdshell_proxy_account 'PowerDomain\PowerUser', 'P@ssw0rd';
-- Grant database access to the SQL Server login account that you want to provide access.
EXEC sp_grantdbaccess 'XPCmdshellUser'
-- Grant execute permission on xp_cmdshell to the SQL Server login account.
GRANT exec ON sys.xp_cmdshell TO [XPCmdshellUser]
GO


lcerni


Viewing all articles
Browse latest Browse all 12963

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>