Hello again everybody,
But hope u can help me again.
As u say Tommy Bollhofer i see the link that u send me but i don't understand some of this points.
My question is as simple as this:
I've one user user etg2 that is owner of database xyz, i need that this user can execute the xp_cmdshell.
So when i see the link that u told me the following commands appears to me but i've som questions to ask u,.
1st:
In the first point the following error appears to me:
"Server: Msg 15123, Level 16, State 1, Procedure sp_configure, Line 79 The configuration option 'xp_cmdshell' does not exist, or it may be an advanced option."
1st.a: why should i've to execute this command?
--1, allow xp_cmdshell
EXEC sp_configure 'xp_cmdshell', 1
RECONFIGURE
GO
2nd:
One error appears when try to create login whit the command that is shown to me.
--2, grant permission to xp_cmdshell
USE master
go
CREATE LOGIN etg2 WITH PASSWORD = '1q2w'
go
--Note, we are in the master database!!!
CREATE USER etg2 FROM LOGIN etg2
From this point forward ive to tell u that i've done nothing but i even don't understand what commands should i execute?
I've only what that usre etg2 that is owner of database xyz can execute the xp_cmdshell.
Hope u can help me.
Thanks and regards
JMSM:blush:
Can u help me on this theme that im feeling a big dunkey.
--Run as login x
EXECUTE AS login = 'etg2'
--Below fails, no execute permission on xp_cmdshell
EXEC xp_cmdshell 'DIR C:\*.*'
REVERT
GO
--Note, we are in the master database!!!
GRANT EXECUTE ON xp_cmdshell TO etg2
--Try again
EXECUTE AS login = 'etg2'
--Execution of xp_cmdshell is allowed.
--But I haven't configured the proxy account...
EXEC xp_cmdshell 'DIR C:\*.*'
REVERT
GO
--3, specify the proxy account for non-syadmins
--Replace obvious parts!
EXEC sp_xp_cmdshell_proxy_account 'Domain\WinAccount','pwd'
EXECUTE AS login = 'etg2'
--Execution of xp_cmdshell is allowed.
--And executes successfully!!!
EXEC xp_cmdshell 'DIR C:\*.*'
REVERT
--Cleanup
EXEC sp_xp_cmdshell_proxy_account null
DROP USER etg2
DROP LOGIN etg2
EXEC sp_configure 'xp_cmdshell', 0
RECONFIGURE