subprocess and win32security.ImpersonateLoggedOnUser

Martin P. Hellwig martin.hellwig at dcuktec.org
Mon Jun 1 11:50:02 EDT 2009


Emin.shopper Martinian.shopper wrote:
>> The source for subprocess just uses CreateProcess. Which means that,
>> short of monkey-patching it, you're going to have to roll your own
>> subprocess-like code (I think). Basically, you'll need to run
>> CreateProcessAsUser or CreateProcessAsLogonW. They're both a bit
>> of a pig in terms of getting the right combination of parameters
>> and privileges,
> 
> Thanks. I tried rolling my own via CreateProcessAsUser but it
> complained about needing some special permissions so its probably not
> going to work. I'd like to try CreateProcessAsLogonW but can't see how
> to access that via python. I will start a new thread on the
> python-win32 list about that.
> 
> Thanks,
> -Emin

Maybe this post on my blog 
http://blog.dcuktec.com/2009/05/python-on-windows-from-service-launch.html
can be of some help for you, although it was more thought to run under 
LocalSystem instead of another active user.

-- 
MPH
http://blog.dcuktec.com
'If consumed, best digested with added seasoning to own preference.'



More information about the Python-list mailing list