Windows User/SQL Login Account unable to run xp_cmdshell

  • Hello,

    Recently in the project, many users needed to run the xp_cmdshell to BCP out table records. However, they are facing the below error:

    "the xp_cmdshell proxy account information cannot be retrieved or is invalid. verify that the ##xp_cmdshell_proxy_account## credential exists and contains valid information.."

    The xp_cmdshell option is enabled through sp_configure for the users to run the xp_cmdshell. Not sure why this does not work.

    Are there any defined steps to be followed for the windows users (they are aligned as part of a few active directory groups) and also for the users who use SQL Login account?

    Kindly suggest!

     

    Thanks.

  • Without any details, this does not sound like a great idea.  I'm curious as to what you are trying to accomplish.

    xp_cmdshell requires admin rights to execute.

    This article shows how non-admins can use xp_cmdshell

    https://www.databasejournal.com/ms-sql/xp-cmdshell-for-non-system-admin-individuals/

    Michael L John
    If you assassinate a DBA, would you pull a trigger?
    To properly post on a forum:
    http://www.sqlservercentral.com/articles/61537/

  • Do NOT let users have direct access to xp_CmdShell...  Write a stored procedure that uses xp_CmdShell with the correct proxy and EXECUTE AS OWNER in the proc.

    NEVER EVER let users have direct execution privs on xp_CmdShell.  It's a great way to read about your company in the morning news if you do.

    --Jeff Moden


    RBAR is pronounced "ree-bar" and is a "Modenism" for Row-By-Agonizing-Row.
    First step towards the paradigm shift of writing Set Based code:
    ________Stop thinking about what you want to do to a ROW... think, instead, of what you want to do to a COLUMN.

    Change is inevitable... Change for the better is not.


    Helpful Links:
    How to post code problems
    How to Post Performance Problems
    Create a Tally Function (fnTally)

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply