V
Vedran Furac
I would like to run a program as another user in win2k. I have runas
utility but with this I need type password all the time. Using python and
windows extensions it is posibile to write a program that will do this, here
is a code:
handel=win32security.LogonUser('username','domain','pass',
win32con.LOGON32_LOGON_INTERACTIVE,win32con.LOGON32_PROVIDER_DEFAULT)
win32security.ImpersonateLoggedOnUser(handel)
print "Started as: ", win32api.GetUserName()
#this prints target username, impersonation successful
os.execv(path, args)
#runs program, not as target user
#win32security.RevertToSelf()
#handel.Close()
...and this runs the program but not as a target user. Program is started just
normal as it would be without impersonation. Any idea why?
utility but with this I need type password all the time. Using python and
windows extensions it is posibile to write a program that will do this, here
is a code:
handel=win32security.LogonUser('username','domain','pass',
win32con.LOGON32_LOGON_INTERACTIVE,win32con.LOGON32_PROVIDER_DEFAULT)
win32security.ImpersonateLoggedOnUser(handel)
print "Started as: ", win32api.GetUserName()
#this prints target username, impersonation successful
os.execv(path, args)
#runs program, not as target user
#win32security.RevertToSelf()
#handel.Close()
...and this runs the program but not as a target user. Program is started just
normal as it would be without impersonation. Any idea why?