Windows用户启动过程*已解决* [英] start process with a windows user *solved*
问题描述
大家好,
我想知道在没有密码的情况下使用另一个用户启动过程的方法.
通过asp.net中的Windows身份验证对用户进行身份验证,我从他那里获得了Identity以创建WindowsImpersonationContext.我需要身份来创建证书,并通过一个过程来完成.
Hi all,
I want to know ways to start a process using another user without having the password.
The user is authenticated via Windows authentication in asp.net and I get the Identity from him to create WindowsImpersonationContext. I need the Identity to create a certificate, doing this with a process.
WindowsIdentity wi = getIdentity();
WindowsImpersonationContext wic = wi.Impersonate();
System.Diagnostics.Process proc1 = new System.Diagnostics.Process();
try
{
proc1.StartInfo.WorkingDirectory = pathDir;
proc1.StartInfo.FileName = pathexe;
proc1.StartInfo.UseShellExecute = false;
proc1.StartInfo.Arguments = argumentsreq;
proc1.Start();
proc1.WaitForExit();
proc1.StartInfo.Arguments = argumentscert;
proc1.Start();
proc1.WaitForExit();
}
catch
{
}
finally
{
}
wic.Undo();
我认为新过程是由模拟用户运行的,但事实并非如此.
现在,我遇到了问题,因此请使用模拟用户启动该过程,因为我没有密码.
我已经阅读了一些有关可以使用身份创建的令牌的信息,但这是运行该过程的最简单方法吗?有没有更好的办法?如果没有,该如何使用令牌运行该过程?
I thougth the new process is run by the impersonated user, but it is not so.
Now I have the problem so start the process with the impersonated user, because I don´t have the password.
I have read something about tokens I could create with the identity, but is that the easiest way to run the process? Is there a better way? If not, how can I run the process with a token?
推荐答案
您不能.
进程由启动进程的人员的安全上下文运行.如果要以其他用户身份运行,则必须具有该用户的密码.
You can''t.
Processes are run by the security context of who started it. If you want to run as a different user you have to have the passwords of that user.
这篇关于Windows用户启动过程*已解决*的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!