xp_cmdshell

  • I am trying to use a proxy account for xp_cmdshell but the SQL Server account (domain\SQLServerAccount) seems to be used instead of the proxy account. I have created the credential as follows:

    sp_xp_cmdshell_proxy_account 'domain\SQLProxyAccount', 'Pwd'

    and granted execute on xp_cmdshell:

    GRANT EXECUTE ON xp_cmdshell TO 'domain\user1'

    Then, when I run SSMS as domain\user1 and run this:

    xp_cmdshell 'echo %username%'

    I would expect to see domain\SQLProxyAccount but I see domain\SQLServerAccount instead.

    Domain\user1 is not part of the sysadmin server role, it is just a standard user with minimal access.

    Does anybody know why this is working this way? Books Online says that xp_cmdshell will only run under the SQL Server account if the user is part of the sysadmin server role.

    Thanks.

  • Duplicate post. No replies to this thread please. Direct replies to:http://qa.sqlservercentral.com/Forums/Topic693043-359-1.aspx

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass
  • How do I delete this duplicate post? I've tried clicking on "Delete" but that doesn't seem to work. Is there a delay? Does the delete need to be approved by a moderator first?

  • You can't delete threads, don't worry about it. If it happens again, just post into one of the threads a note that it's a duplicate and where the replies should go (much like I did). No big deal.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

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

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