How to ImpersonateLoggedOnUser on Windows NT/2000?

Gary Herron gherron at islandtraining.com
Tue Jun 25 13:34:35 EDT 2002


Hi,

I'm trying to write a script for both Windows NT/2000 and Linux which
needs to perform actions on the behalf of several different users.

On Linux I use "os.seteuid" and friends and all is fine.

On NT the comparable thing seems to be LogonUser,
ImpersonateLoggedOnUser, and RevertToSelf.  However for these calls to
be successful, one needs various privileges, such as SE_TCB_NAME, and
SE_CHANGE_NOTIFY_NAME..

At this point I start getting lost, so I hope someone who has been
through this can help me.  How can a Python program running as local
administrator on Windows NT/2000 set those privileges, and then once
set, how does one actually *do* the impersonation?

Thank you,
Dr. Gary Herron







More information about the Python-list mailing list