tsql - sql server agent proxy account -
i trying use proxy account non sysadmin grant them exec permission on xp_cmdshell. did is:
use [master] go create credential [proxyaccount] identity = n'domain\user', secret = n'password' go use [master] go create credential [proxyaccount] 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 user tries do
xp_cmdshell 'dir c:'
it gives following error:
msg 229, level 14, state 5, procedure xp_cmdshell, line 1 execute permission denied on object 'xp_cmdshell', database 'mssqlsystemresource', schema 'sys'.
anyone knows else should doing? login has connect permission server.
thanks in advance
you shoud use
exec sp_xp_cmdshell_proxy_account 'domain\user', 'password';
instead. not 100% sure think xp_cmdshell explicitly looks proxy account called ##xp_cmdshell_proxy_account## - stired procedure above create you.
Comments
Post a Comment