Note that there are some explanatory texts on larger screens.

plurals
  1. POExecute xp_cmdshell command as specific user
    primarykey
    data
    text
    <p>I would like to run <strong>xp_cmdshell</strong> (TSQL procedure) in order to mount a network drive and then access remotes mdb files.</p> <p>I am administrator on the MS SQL server and I have allowed <strong>xp_cmdshell</strong> execution accordingly.</p> <p>However, there is still a problem:</p> <ul> <li><p>When I call xp_cmdshell, the user executing the command is the SQL <em>SysAdmin</em>, i.e. the account who run SQL Server process.</p></li> <li><p>I wish <strong>xp_cmdshell</strong> executes as the account with which I'm connected to SQL server, i.e <em>Administrator</em></p></li> </ul> <p>Both of theses account are in administrator group, SQLAdmin group, and are granted to CONTROL SERVER. Both users belong to the same domain. All of this is run on the same machine.</p> <p>Because of this conflict, I cannot use a network drive because it is mounted for <em>SysAdmin</em> and not for <em>Administrator</em><br> I tried to use <strong>sp_ xp_ cmdshell_ proxy_ account</strong> to specify the account with which I want to run <strong>xp_cmdshell</strong>, but <em>SysAdmin</em> is still the used account.</p> <p>Therefore, this code :<br> <code>select user_name(), suser_name;</code><br> <code>exec xp_cmdshell 'echo %username%';</code> </p> <p>displays :<br> <code>Administrator Administrator</code><br> <code>SysAdmin</code></p> <p>Does anybody knows how to impersonate well the <strong>xp_cmdshell</strong> command ? Is there something to (re)configure?</p> <p>Thanks for your help.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload