March 2, 2009 at 5:38 am
Hi all,
When I call exec xp_cmdshell from another client with a sql login(testUser), I am getting
QUERY: exec master.dbo.xp_cmdshell '@ECHO deneme > C:\SqlOut.txt'
RESULT: 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'.
Then I try to enable xp_cmdshell on testUser with the following result:
QUERY: USE master;
GRANT EXECUTE ON sys.xp_cmdshell TO testUser;
RESULT:Msg 15151, Level 16, State 1, Line 2
Cannot find the user 'testUser', because it does not exist or you do not have permission.
How do i exceed these followings?
March 2, 2009 at 6:35 am
I think this user is not a valid user under master database. Add it there and if this login id is not a sysadmin and there is no proxy account set up then you won't be able to execute this command.
MJ
March 2, 2009 at 6:45 am
I mapped testUser to master database then execute GRANT command, it completed successfully.
Then I try to execute
QUERY: USE master;
EXEC sp_xp_cmdshell_proxy_account 'testUser', 'Asdf1234'
RESULT: Msg 15137, Level 16, State 1, Procedure sp_xp_cmdshell_proxy_account, Line 1
An error occurred during the execution of sp_xp_cmdshell_proxy_account. Possible reasons: the provided account was invalid or the '##xp_cmdshell_proxy_account##' credential could not be created. Error code: '0'.
March 2, 2009 at 6:48 am
As i told you make it a member of sysadmin role and then it will allow u to execute this query.
MJ
March 2, 2009 at 7:27 am
Hi,
Is there any way to succeed this without assigning sysadmin role?
March 2, 2009 at 11:30 pm
thinknight (3/2/2009)
Hi,Is there any way to succeed this without assigning sysadmin role?
You can find more information here
Pradeep Adiga
Blog: sqldbadiaries.com
Twitter: @pradeepadiga
March 3, 2009 at 3:12 am
The SQL Server FineBuild Reference manual has a good description on how SQL proxy accounts are used, how to create them, what security is needed, and best practices for SQL Agent proxies (if you also need those).
There are other good sources of information about this elsewhere. Google can find most of them for you.
Original author: https://github.com/SQL-FineBuild/Common/wiki/ 1-click install and best practice configuration of SQL Server 2019, 2017 2016, 2014, 2012, 2008 R2, 2008 and 2005.
When I give food to the poor they call me a saint. When I ask why they are poor they call me a communist - Archbishop Hélder Câmara
Viewing 7 posts - 1 through 6 (of 6 total)
You must be logged in to reply to this topic. Login to reply