views:

20

answers:

0

Hi,

I am trying to use proxy account for non sysadmin to grant them exec permission on xp_cmdshell. What I did is:

USE [master]
GO
CREATE CREDENTIAL [proxyaccount] WITH IDENTITY = N'domain\user', SECRET = N'password'
GO
USE [master]
GO
CREATE CREDENTIAL [proxyaccount] WITH IDENTITY = N'domain\user', SECRET = N'password'
GO

USE [msdb]
GO
EXEC msdb.dbo.sp_add_proxy @proxy_name=N'myproxy',@credential_name=N'proxyaccount',
                @enabled=1
GO
EXEC msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=N'myproxy', @subsystem_id=2  
GO
EXEC msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=N'myproxy', @subsystem_id=3
GO
EXEC msdb.dbo.sp_grant_proxy_to_subsystem @proxy_name=N'myproxy', @subsystem_id=11
GO

But still when the user tries to do

xp_cmdshell 'dir c:'

It gives the following error:

Msg 229, Level 14, State 5, Procedure xp_cmdshell, Line 1
The EXECUTE permission was denied on the object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.

Anyone knows what else should i be doing? The login only has connect permission to the server.

thanks in advance