Home All Groups Group Topic Archive Search About

xp_cmdshell failed to execute because current security context is

Author
9 Jun 2009 1:41 PM
db
Microsoft SQL server standard edition
Microsoft windows NT 5.2 (3790)
Platform: NT INTEL X86
Version: 8.00.2039
SQL server 2000 SP4

Application error log has following message:
xp_cmdshell failed to execute because current security context is not
sysadmin and proxy acount is not setup correctly. For more information, refer
to Book Online, search for topic related to xp_sqlagent_proxy_account. com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source) com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source) com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
Source) com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)


--
dbdba
ontario, canada

Author
9 Jun 2009 2:01 PM
Tom Moreau
Check out:

http://msdn.microsoft.com/en-us/library/aa260689(SQL.80).aspx

--
   Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"db" <d*@discussions.microsoft.com> wrote in message
news:CCE100AE-5BEB-4C80-9450-5DE16BD36E92@microsoft.com...
Microsoft SQL server standard edition
Microsoft windows NT 5.2 (3790)
Platform: NT INTEL X86
Version: 8.00.2039
SQL server 2000 SP4

Application error log has following message:
xp_cmdshell failed to execute because current security context is not
sysadmin and proxy acount is not setup correctly. For more information,
refer
to Book Online, search for topic related to xp_sqlagent_proxy_account.
com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
Source)
com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
Source)


--
dbdba
ontario, canada
Are all your drivers up to date? click for free checkup

Author
9 Jun 2009 2:40 PM
db
Thanks Tom. I have checked that article.
When I run " xp_cmdshell 'dir *.exe'" useing master database I get the
directory listing. When I run it against the production database I get:
==============================
Server: Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'xp_cmdshell'.
=============================
--
ontario, canada


Show quoteHide quote
"db" wrote:

> Microsoft SQL server standard edition
> Microsoft windows NT 5.2 (3790)
> Platform: NT INTEL X86
> Version: 8.00.2039
> SQL server 2000 SP4
>
> Application error log has following message:
> xp_cmdshell failed to execute because current security context is not
> sysadmin and proxy acount is not setup correctly. For more information, refer
> to Book Online, search for topic related to xp_sqlagent_proxy_account.
> com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown Source)
> com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown Source)
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown Source)
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown Source)
> com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown Source)
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown Source)
>

> --
> dbdba
> ontario, canada
Author
9 Jun 2009 2:58 PM
Tom Moreau
Did you run it as master.dbo.xp_cmdshell?

--
   Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"db" <d*@discussions.microsoft.com> wrote in message
news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
Thanks Tom. I have checked that article.
When I run " xp_cmdshell 'dir *.exe'" useing master database I get the
directory listing. When I run it against the production database I get:
==============================
Server: Msg 2812, Level 16, State 62, Line 1
Could not find stored procedure 'xp_cmdshell'.
=============================
--
ontario, canada


Show quoteHide quote
"db" wrote:

> Microsoft SQL server standard edition
> Microsoft windows NT 5.2 (3790)
> Platform: NT INTEL X86
> Version: 8.00.2039
> SQL server 2000 SP4
>
> Application error log has following message:
> xp_cmdshell failed to execute because current security context is not
> sysadmin and proxy acount is not setup correctly. For more information,
> refer
> to Book Online, search for topic related to xp_sqlagent_proxy_account.
> com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> Source)
> com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
> Source)
>
>
> --
> dbdba
> ontario, canada
Author
9 Jun 2009 3:11 PM
db
No. Yes it works as master.dbo.xp_cmdshell. But still in the application I
have that error message. I do not have access to application code but in the
logs I still have the same error message. What could be the issue?
--
ontario, canada


Show quoteHide quote
"Tom Moreau" wrote:

> Did you run it as master.dbo.xp_cmdshell?
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "db" <d*@discussions.microsoft.com> wrote in message
> news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
> Thanks Tom. I have checked that article.
> When I run " xp_cmdshell 'dir *.exe'" useing master database I get the
> directory listing. When I run it against the production database I get:
> ==============================
> Server: Msg 2812, Level 16, State 62, Line 1
> Could not find stored procedure 'xp_cmdshell'.
> =============================
> --
> ontario, canada
>
>
> "db" wrote:
>
> > Microsoft SQL server standard edition
> > Microsoft windows NT 5.2 (3790)
> > Platform: NT INTEL X86
> > Version: 8.00.2039
> > SQL server 2000 SP4
> >
> > Application error log has following message:
> > xp_cmdshell failed to execute because current security context is not
> > sysadmin and proxy acount is not setup correctly. For more information,
> > refer
> > to Book Online, search for topic related to xp_sqlagent_proxy_account.
> > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
> > Source)
> >
> >
> > --
> > dbdba
> > ontario, canada
>
>
Author
9 Jun 2009 3:23 PM
Tom Moreau
When you run xp_cmdshell yourself, are you a system admin?  Has the user
been granted permission to execute xp_cmdshell?

--
   Tom

----------------------------------------------------
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
SQL Server MVP
Toronto, ON   Canada
https://mvp.support.microsoft.com/profile/Tom.Moreau


"db" <d*@discussions.microsoft.com> wrote in message
news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
No. Yes it works as master.dbo.xp_cmdshell. But still in the application I
have that error message. I do not have access to application code but in the
logs I still have the same error message. What could be the issue?
--
ontario, canada


Show quoteHide quote
"Tom Moreau" wrote:

> Did you run it as master.dbo.xp_cmdshell?
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "db" <d*@discussions.microsoft.com> wrote in message
> news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
> Thanks Tom. I have checked that article.
> When I run " xp_cmdshell 'dir *.exe'" useing master database I get the
> directory listing. When I run it against the production database I get:
> ==============================
> Server: Msg 2812, Level 16, State 62, Line 1
> Could not find stored procedure 'xp_cmdshell'.
> =============================
> --
> ontario, canada
>
>
> "db" wrote:
>
> > Microsoft SQL server standard edition
> > Microsoft windows NT 5.2 (3790)
> > Platform: NT INTEL X86
> > Version: 8.00.2039
> > SQL server 2000 SP4
> >
> > Application error log has following message:
> > xp_cmdshell failed to execute because current security context is not
> > sysadmin and proxy acount is not setup correctly. For more information,
> > refer
> > to Book Online, search for topic related to xp_sqlagent_proxy_account.
> > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> > Source)
> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
> > Source)
> >
> >
> > --
> > dbdba
> > ontario, canada
>
>
Author
9 Jun 2009 4:05 PM
Tibor Karaszi
Also, below might or might not be useful:

http://sqlblog.com/blogs/tibor_karaszi/archive/2007/08/23/xp-cmdshell-and-permissions.aspx

Show quoteHide quote
"Tom Moreau" <tom@dont.spam.me.cips.ca> wrote in message
news:OTX1mZR6JHA.1424@TK2MSFTNGP02.phx.gbl...
> When you run xp_cmdshell yourself, are you a system admin?  Has the
> user
> been granted permission to execute xp_cmdshell?
>
> --
>   Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "db" <d*@discussions.microsoft.com> wrote in message
> news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
> No. Yes it works as master.dbo.xp_cmdshell. But still in the
> application I
> have that error message. I do not have access to application code
> but in the
> logs I still have the same error message. What could be the issue?
> --
> ontario, canada
>
>
> "Tom Moreau" wrote:
>
>> Did you run it as master.dbo.xp_cmdshell?
>>
>> --
>>    Tom
>>
>> ----------------------------------------------------
>> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> SQL Server MVP
>> Toronto, ON   Canada
>> https://mvp.support.microsoft.com/profile/Tom.Moreau
>>
>>
>> "db" <d*@discussions.microsoft.com> wrote in message
>> news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
>> Thanks Tom. I have checked that article.
>> When I run " xp_cmdshell 'dir *.exe'" useing master database I get
>> the
>> directory listing. When I run it against the production database I
>> get:
>> ==============================
>> Server: Msg 2812, Level 16, State 62, Line 1
>> Could not find stored procedure 'xp_cmdshell'.
>> =============================
>> --
>> ontario, canada
>>
>>
>> "db" wrote:
>>
>> > Microsoft SQL server standard edition
>> > Microsoft windows NT 5.2 (3790)
>> > Platform: NT INTEL X86
>> > Version: 8.00.2039
>> > SQL server 2000 SP4
>> >
>> > Application error log has following message:
>> > xp_cmdshell failed to execute because current security context is
>> > not
>> > sysadmin and proxy acount is not setup correctly. For more
>> > information,
>> > refer
>> > to Book Online, search for topic related to
>> > xp_sqlagent_proxy_account.
>> > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
>> > Source)
>> > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
>> > Source)
>> >
>> >
>> > --
>> > dbdba
>> > ontario, canada
>>
>>
>
Author
10 Jun 2009 12:46 PM
db
How to check if user has the permission to execute xp_cmdshell and if user
does not have permission, how to grant permission.

--
ontario, canada


Show quoteHide quote
"Tom Moreau" wrote:

> When you run xp_cmdshell yourself, are you a system admin?  Has the user
> been granted permission to execute xp_cmdshell?
>
> --
>    Tom
>
> ----------------------------------------------------
> Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> SQL Server MVP
> Toronto, ON   Canada
> https://mvp.support.microsoft.com/profile/Tom.Moreau
>
>
> "db" <d*@discussions.microsoft.com> wrote in message
> news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
> No. Yes it works as master.dbo.xp_cmdshell. But still in the application I
> have that error message. I do not have access to application code but in the
> logs I still have the same error message. What could be the issue?
> --
> ontario, canada
>
>
> "Tom Moreau" wrote:
>
> > Did you run it as master.dbo.xp_cmdshell?
> >
> > --
> >    Tom
> >
> > ----------------------------------------------------
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> > SQL Server MVP
> > Toronto, ON   Canada
> > https://mvp.support.microsoft.com/profile/Tom.Moreau
> >
> >
> > "db" <d*@discussions.microsoft.com> wrote in message
> > news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
> > Thanks Tom. I have checked that article.
> > When I run " xp_cmdshell 'dir *.exe'" useing master database I get the
> > directory listing. When I run it against the production database I get:
> > ==============================
> > Server: Msg 2812, Level 16, State 62, Line 1
> > Could not find stored procedure 'xp_cmdshell'.
> > =============================
> > --
> > ontario, canada
> >
> >
> > "db" wrote:
> >
> > > Microsoft SQL server standard edition
> > > Microsoft windows NT 5.2 (3790)
> > > Platform: NT INTEL X86
> > > Version: 8.00.2039
> > > SQL server 2000 SP4
> > >
> > > Application error log has following message:
> > > xp_cmdshell failed to execute because current security context is not
> > > sysadmin and proxy acount is not setup correctly. For more information,
> > > refer
> > > to Book Online, search for topic related to xp_sqlagent_proxy_account.
> > > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> > > Source)
> > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
> > > Source)
> > >
> > >
> > > --
> > > dbdba
> > > ontario, canada
> >
> >
>
>
Author
10 Jun 2009 6:29 PM
db
Hi Tibor/Tom

I created proxy account but I am getting this error message:

xp_cmdshell failed to execute because CreateProcessAsUserW returns error
1314. please make sure the service account SQL Server running under has
appropriate privilege. For more information, search Book Online for topic
related to xp_sqlagent_proxy_accoun

Thanks for all your helpful hints

--
ontario, canada


Show quoteHide quote
"db" wrote:

> How to check if user has the permission to execute xp_cmdshell and if user
> does not have permission, how to grant permission.
>
> --
> ontario, canada
>
>
> "Tom Moreau" wrote:
>
> > When you run xp_cmdshell yourself, are you a system admin?  Has the user
> > been granted permission to execute xp_cmdshell?
> >
> > --
> >    Tom
> >
> > ----------------------------------------------------
> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> > SQL Server MVP
> > Toronto, ON   Canada
> > https://mvp.support.microsoft.com/profile/Tom.Moreau
> >
> >
> > "db" <d*@discussions.microsoft.com> wrote in message
> > news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
> > No. Yes it works as master.dbo.xp_cmdshell. But still in the application I
> > have that error message. I do not have access to application code but in the
> > logs I still have the same error message. What could be the issue?
> > --
> > ontario, canada
> >
> >
> > "Tom Moreau" wrote:
> >
> > > Did you run it as master.dbo.xp_cmdshell?
> > >
> > > --
> > >    Tom
> > >
> > > ----------------------------------------------------
> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> > > SQL Server MVP
> > > Toronto, ON   Canada
> > > https://mvp.support.microsoft.com/profile/Tom.Moreau
> > >
> > >
> > > "db" <d*@discussions.microsoft.com> wrote in message
> > > news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
> > > Thanks Tom. I have checked that article.
> > > When I run " xp_cmdshell 'dir *.exe'" useing master database I get the
> > > directory listing. When I run it against the production database I get:
> > > ==============================
> > > Server: Msg 2812, Level 16, State 62, Line 1
> > > Could not find stored procedure 'xp_cmdshell'.
> > > =============================
> > > --
> > > ontario, canada
> > >
> > >
> > > "db" wrote:
> > >
> > > > Microsoft SQL server standard edition
> > > > Microsoft windows NT 5.2 (3790)
> > > > Platform: NT INTEL X86
> > > > Version: 8.00.2039
> > > > SQL server 2000 SP4
> > > >
> > > > Application error log has following message:
> > > > xp_cmdshell failed to execute because current security context is not
> > > > sysadmin and proxy acount is not setup correctly. For more information,
> > > > refer
> > > > to Book Online, search for topic related to xp_sqlagent_proxy_account.
> > > > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> > > > Source)
> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
> > > > Source)
> > > >
> > > >
> > > > --
> > > > dbdba
> > > > ontario, canada
> > >
> > >
> >
> >
Author
11 Jun 2009 3:16 AM
Uri Dimant
db
http://support.microsoft.com/kb/248391
http://sqlblog.com/blogs/tibor_karaszi/archive/2007/08/23/xp-cmdshell-and-permissions.aspx






Show quoteHide quote
"db" <d*@discussions.microsoft.com> wrote in message
news:E9019C81-FE57-4A2C-8B1E-0BF8F020399A@microsoft.com...
> Hi Tibor/Tom
>
> I created proxy account but I am getting this error message:
>
> xp_cmdshell failed to execute because CreateProcessAsUserW returns error
> 1314. please make sure the service account SQL Server running under has
> appropriate privilege. For more information, search Book Online for topic
> related to xp_sqlagent_proxy_accoun
>
> Thanks for all your helpful hints
>
> --
> ontario, canada
>
>
> "db" wrote:
>
>> How to check if user has the permission to execute xp_cmdshell and if
>> user
>> does not have permission, how to grant permission.
>>
>> --
>> ontario, canada
>>
>>
>> "Tom Moreau" wrote:
>>
>> > When you run xp_cmdshell yourself, are you a system admin?  Has the
>> > user
>> > been granted permission to execute xp_cmdshell?
>> >
>> > --
>> >    Tom
>> >
>> > ----------------------------------------------------
>> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> > SQL Server MVP
>> > Toronto, ON   Canada
>> > https://mvp.support.microsoft.com/profile/Tom.Moreau
>> >
>> >
>> > "db" <d*@discussions.microsoft.com> wrote in message
>> > news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
>> > No. Yes it works as master.dbo.xp_cmdshell. But still in the
>> > application I
>> > have that error message. I do not have access to application code but
>> > in the
>> > logs I still have the same error message. What could be the issue?
>> > --
>> > ontario, canada
>> >
>> >
>> > "Tom Moreau" wrote:
>> >
>> > > Did you run it as master.dbo.xp_cmdshell?
>> > >
>> > > --
>> > >    Tom
>> > >
>> > > ----------------------------------------------------
>> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> > > SQL Server MVP
>> > > Toronto, ON   Canada
>> > > https://mvp.support.microsoft.com/profile/Tom.Moreau
>> > >
>> > >
>> > > "db" <d*@discussions.microsoft.com> wrote in message
>> > > news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
>> > > Thanks Tom. I have checked that article.
>> > > When I run " xp_cmdshell 'dir *.exe'" useing master database I get
>> > > the
>> > > directory listing. When I run it against the production database I
>> > > get:
>> > > ==============================
>> > > Server: Msg 2812, Level 16, State 62, Line 1
>> > > Could not find stored procedure 'xp_cmdshell'.
>> > > =============================
>> > > --
>> > > ontario, canada
>> > >
>> > >
>> > > "db" wrote:
>> > >
>> > > > Microsoft SQL server standard edition
>> > > > Microsoft windows NT 5.2 (3790)
>> > > > Platform: NT INTEL X86
>> > > > Version: 8.00.2039
>> > > > SQL server 2000 SP4
>> > > >
>> > > > Application error log has following message:
>> > > > xp_cmdshell failed to execute because current security context is
>> > > > not
>> > > > sysadmin and proxy acount is not setup correctly. For more
>> > > > information,
>> > > > refer
>> > > > to Book Online, search for topic related to
>> > > > xp_sqlagent_proxy_account.
>> > > > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
>> > > > Source)
>> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
>> > > > Source)
>> > > >
>> > > >
>> > > > --
>> > > > dbdba
>> > > > ontario, canada
>> > >
>> > >
>> >
>> >
Author
11 Jun 2009 2:02 PM
db
Hi

I followed all the blogs and looks like I resolved first error. Now i am
getting:

INFO: databasename: xp_cmdshell failed to execute because
CreateProcessAsUserW returns error 1314. please make sure the service account
SQL Server running under has appropriate privilege.

SQL server runs under a domain account. The error occurs because the SQL
Server service account does not have all the relevant permissions not the sql
server agent or proxy account. Please let me know
what rights and priviledges should i give to sql server service account.

Thanks a lot for all the help.
--
ontario, canada


Show quoteHide quote
"Uri Dimant" wrote:

> db
> http://support.microsoft.com/kb/248391
> http://sqlblog.com/blogs/tibor_karaszi/archive/2007/08/23/xp-cmdshell-and-permissions.aspx
>
>
>
>
>
>
> "db" <d*@discussions.microsoft.com> wrote in message
> news:E9019C81-FE57-4A2C-8B1E-0BF8F020399A@microsoft.com...
> > Hi Tibor/Tom
> >
> > I created proxy account but I am getting this error message:
> >
> > xp_cmdshell failed to execute because CreateProcessAsUserW returns error
> > 1314. please make sure the service account SQL Server running under has
> > appropriate privilege. For more information, search Book Online for topic
> > related to xp_sqlagent_proxy_accoun
> >
> > Thanks for all your helpful hints
> >
> > --
> > ontario, canada
> >
> >
> > "db" wrote:
> >
> >> How to check if user has the permission to execute xp_cmdshell and if
> >> user
> >> does not have permission, how to grant permission.
> >>
> >> --
> >> ontario, canada
> >>
> >>
> >> "Tom Moreau" wrote:
> >>
> >> > When you run xp_cmdshell yourself, are you a system admin?  Has the
> >> > user
> >> > been granted permission to execute xp_cmdshell?
> >> >
> >> > --
> >> >    Tom
> >> >
> >> > ----------------------------------------------------
> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> >> > SQL Server MVP
> >> > Toronto, ON   Canada
> >> > https://mvp.support.microsoft.com/profile/Tom.Moreau
> >> >
> >> >
> >> > "db" <d*@discussions.microsoft.com> wrote in message
> >> > news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
> >> > No. Yes it works as master.dbo.xp_cmdshell. But still in the
> >> > application I
> >> > have that error message. I do not have access to application code but
> >> > in the
> >> > logs I still have the same error message. What could be the issue?
> >> > --
> >> > ontario, canada
> >> >
> >> >
> >> > "Tom Moreau" wrote:
> >> >
> >> > > Did you run it as master.dbo.xp_cmdshell?
> >> > >
> >> > > --
> >> > >    Tom
> >> > >
> >> > > ----------------------------------------------------
> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
> >> > > SQL Server MVP
> >> > > Toronto, ON   Canada
> >> > > https://mvp.support.microsoft.com/profile/Tom.Moreau
> >> > >
> >> > >
> >> > > "db" <d*@discussions.microsoft.com> wrote in message
> >> > > news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
> >> > > Thanks Tom. I have checked that article.
> >> > > When I run " xp_cmdshell 'dir *.exe'" useing master database I get
> >> > > the
> >> > > directory listing. When I run it against the production database I
> >> > > get:
> >> > > ==============================
> >> > > Server: Msg 2812, Level 16, State 62, Line 1
> >> > > Could not find stored procedure 'xp_cmdshell'.
> >> > > =============================
> >> > > --
> >> > > ontario, canada
> >> > >
> >> > >
> >> > > "db" wrote:
> >> > >
> >> > > > Microsoft SQL server standard edition
> >> > > > Microsoft windows NT 5.2 (3790)
> >> > > > Platform: NT INTEL X86
> >> > > > Version: 8.00.2039
> >> > > > SQL server 2000 SP4
> >> > > >
> >> > > > Application error log has following message:
> >> > > > xp_cmdshell failed to execute because current security context is
> >> > > > not
> >> > > > sysadmin and proxy acount is not setup correctly. For more
> >> > > > information,
> >> > > > refer
> >> > > > to Book Online, search for topic related to
> >> > > > xp_sqlagent_proxy_account.
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
> >> > > > Source)
> >> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
> >> > > > Source)
> >> > > >
> >> > > >
> >> > > > --
> >> > > > dbdba
> >> > > > ontario, canada
> >> > >
> >> > >
> >> >
> >> >
>
>
>
Author
11 Jun 2009 5:38 PM
Tibor Karaszi
The permissions needed are outlined in the KB that Uri posted. When
you install SQL Server, you get a bunch of groups, one for each
service for that instance. The permissions needed are assigned to this
group. So you need to make sure that your service account is a member
of this group. Note that in this case we are talking about the SQL
Server service.

Show quoteHide quote
"db" <d*@discussions.microsoft.com> wrote in message
news:DCC22CD2-93A8-439F-94B7-A7C9BBDA76B7@microsoft.com...
>
> Hi
>
> I followed all the blogs and looks like I resolved first error. Now
> i am
> getting:
>
> INFO: databasename: xp_cmdshell failed to execute because
> CreateProcessAsUserW returns error 1314. please make sure the
> service account
> SQL Server running under has appropriate privilege.
>
> SQL server runs under a domain account. The error occurs because the
> SQL
> Server service account does not have all the relevant permissions
> not the sql
> server agent or proxy account. Please let me know
> what rights and priviledges should i give to sql server service
> account.
>
> Thanks a lot for all the help.
> --
> ontario, canada
>
>
> "Uri Dimant" wrote:
>
>> db
>> http://support.microsoft.com/kb/248391
>> http://sqlblog.com/blogs/tibor_karaszi/archive/2007/08/23/xp-cmdshell-and-permissions.aspx
>>
>>
>>
>>
>>
>>
>> "db" <d*@discussions.microsoft.com> wrote in message
>> news:E9019C81-FE57-4A2C-8B1E-0BF8F020399A@microsoft.com...
>> > Hi Tibor/Tom
>> >
>> > I created proxy account but I am getting this error message:
>> >
>> > xp_cmdshell failed to execute because CreateProcessAsUserW
>> > returns error
>> > 1314. please make sure the service account SQL Server running
>> > under has
>> > appropriate privilege. For more information, search Book Online
>> > for topic
>> > related to xp_sqlagent_proxy_accoun
>> >
>> > Thanks for all your helpful hints
>> >
>> > --
>> > ontario, canada
>> >
>> >
>> > "db" wrote:
>> >
>> >> How to check if user has the permission to execute xp_cmdshell
>> >> and if
>> >> user
>> >> does not have permission, how to grant permission.
>> >>
>> >> --
>> >> ontario, canada
>> >>
>> >>
>> >> "Tom Moreau" wrote:
>> >>
>> >> > When you run xp_cmdshell yourself, are you a system admin?
>> >> > Has the
>> >> > user
>> >> > been granted permission to execute xp_cmdshell?
>> >> >
>> >> > --
>> >> >    Tom
>> >> >
>> >> > ----------------------------------------------------
>> >> > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> >> > SQL Server MVP
>> >> > Toronto, ON   Canada
>> >> > https://mvp.support.microsoft.com/profile/Tom.Moreau
>> >> >
>> >> >
>> >> > "db" <d*@discussions.microsoft.com> wrote in message
>> >> > news:0221B5E0-9A04-4FDC-94FD-076BCA9FB626@microsoft.com...
>> >> > No. Yes it works as master.dbo.xp_cmdshell. But still in the
>> >> > application I
>> >> > have that error message. I do not have access to application
>> >> > code but
>> >> > in the
>> >> > logs I still have the same error message. What could be the
>> >> > issue?
>> >> > --
>> >> > ontario, canada
>> >> >
>> >> >
>> >> > "Tom Moreau" wrote:
>> >> >
>> >> > > Did you run it as master.dbo.xp_cmdshell?
>> >> > >
>> >> > > --
>> >> > >    Tom
>> >> > >
>> >> > > ----------------------------------------------------
>> >> > > Thomas A. Moreau, BSc, PhD, MCSE, MCDBA, MCITP, MCTS
>> >> > > SQL Server MVP
>> >> > > Toronto, ON   Canada
>> >> > > https://mvp.support.microsoft.com/profile/Tom.Moreau
>> >> > >
>> >> > >
>> >> > > "db" <d*@discussions.microsoft.com> wrote in message
>> >> > > news:EAB61CBA-6830-4589-8FAC-2F8C852E93CF@microsoft.com...
>> >> > > Thanks Tom. I have checked that article.
>> >> > > When I run " xp_cmdshell 'dir *.exe'" useing master database
>> >> > > I get
>> >> > > the
>> >> > > directory listing. When I run it against the production
>> >> > > database I
>> >> > > get:
>> >> > > ==============================
>> >> > > Server: Msg 2812, Level 16, State 62, Line 1
>> >> > > Could not find stored procedure 'xp_cmdshell'.
>> >> > > =============================
>> >> > > --
>> >> > > ontario, canada
>> >> > >
>> >> > >
>> >> > > "db" wrote:
>> >> > >
>> >> > > > Microsoft SQL server standard edition
>> >> > > > Microsoft windows NT 5.2 (3790)
>> >> > > > Platform: NT INTEL X86
>> >> > > > Version: 8.00.2039
>> >> > > > SQL server 2000 SP4
>> >> > > >
>> >> > > > Application error log has following message:
>> >> > > > xp_cmdshell failed to execute because current security
>> >> > > > context is
>> >> > > > not
>> >> > > > sysadmin and proxy acount is not setup correctly. For more
>> >> > > > information,
>> >> > > > refer
>> >> > > > to Book Online, search for topic related to
>> >> > > > xp_sqlagent_proxy_account.
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDatabaseError(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.doExecutePreparedStatement(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement$PrepStmtExecCmd.doExecute(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.TDSCommand.execute(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeCommand(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerStatement.executeStatement(Unknown
>> >> > > > Source)
>> >> > > > com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.executeUpdate(Unknown
>> >> > > > Source)
>> >> > > >
>> >> > > >
>> >> > > > --
>> >> > > > dbdba
>> >> > > > ontario, canada
>> >> > >
>> >> > >
>> >> >
>> >> >
>>
>>
>>

Bookmark and Share

Post Thread options