Re: xp_cmdshell uses system account instead of sql server account - problem after removing builtin\administrator

From: Andy Svendsen (andymcdba1_at_NOMORESPAM.yahoo.com)
Date: 12/19/03


Date: Thu, 18 Dec 2003 22:12:07 -0500

The job is running from SQL Server Agent? When you go to properties of that
job step and click on Advanced, what user is it running as? What you might
want to do is go to SQL Server Agent properties and check the SQL Proxy
Account.

Another thing you may want to try is scheduling your job from Scheduled
Tasks( go to the Accessories | System Tools program group). You can
schedule the account to run the command under.

--
*******************************************************************
Andy S.
MCSE NT/2000, MCDBA SQL 7/2000
andymcdba1@NOMORESPAM.yahoo.com
Please remove NOMORESPAM before replying.
Always keep your antivirus and Microsoft software
up to date with the latest definitions and product updates.
Be suspicious of every email attachment, I will never send
or post anything other than the text of a http:// link nor
post the link directly to a file for downloading.
This posting is provided "as is" with no warranties
and confers no rights.
*******************************************************************
"Andre Kamman" <Andre@nospam:kamman.net> wrote in message
news:ee21WqaxDHA.2148@TK2MSFTNGP12.phx.gbl...
> Hi,
>
> We have a job that starts a stored procedure that sends an OSQL command
> using xp_cmdshell. The OSQL command has to log back into the database
using
> a trusted connection.
> This worked until we removed the builtin\authentication login.
> Testing reveiled that the OSQL command tries to log in using the NT
> Authority\SYSTEM account.
> The server and the agent run using windows account that are both admins.
The
> job owner is sa. The stored procedure is owned by the sa.
> Books online states that xp_cmdshell runs under the SQL Server account,
but
> my test shows this is not the case
> I have included my test, you can run it from within a query analyzer
window
> in the master database.
>
> master..xp_cmdshell 'osql -s . -E -Q"select suser_sname()"'
>
> Is this a "bug" in books online ?
>
> Greetings,
>
> André
>
>