[python-win32] Using LogonUser with Guest account
billiejoex at gmail.com
Fri Mar 28 13:23:38 CET 2008
Roger Upole wrote:
>> I'm trying to write a plug-in for a ftp server of mine to permit the
>> integration with accounts defined on the Windows system.
>> What I basically need is impersonating a user, execute e filesystem
>> call (e.g. create a directory via os.mkdir()) and then switch back to
>> the original user (Administrator).
>> I wrote down this simple class which seems to fit pretty well for my
>> class WinNTAuthorizer:
>> def impersonate_user(self, username, password):
>> self.impersonated_user_handler = win32security.LogonUser(
>> def terminate_impersonation(self):
>> What I need now is impersonating the Guest user to handle the
>> anonymous logins (which it's exactly what IIS FTPd does) but I don't
>> know how to do it.
>> Does Guest account has a password or do I have to use something
>> different than LogonUser to manage it?
>> Could someone point me in the right direction?
>> Thanks in advance.
> I think you're looking for win32security.ImpersonateAnonymousToken.
> Note that Anonymous is not the same thing as the Guest account.
By reading MSDN it seems it should be used with threads (while I'm in
an asynchronous environment) and I'm not even sure that's what I need.
Could you provide an example code?
More information about the python-win32