Reputation: 3732
I am trying to impersonate a user in python and call a CMD command :
login('secondUser','123')
os.system("some CMD command ")
logout()
where log in and logout are functions that uses win32api
to impersonate user.
The problem is that os.system
does not execute the command as the impersonated user (secondUser
), it executes the command as the user logged in to the system.
I use windows7 64x , and python 2.7
Is there a way to call a CMD
command with an impersonated user?
Upvotes: 3
Views: 3071
Reputation: 7257
os.system() surely is the wrong tool for the job. Try CreateProcess from the win32api module if you are using it anyway.
Upvotes: 2