Win32 Impersonation

logistix logstx at bellatlantic.net
Fri Mar 29 16:10:36 EST 2002


You need to have the "Act as part of the Operating System" local security
policy set.  I'm don't think that even the administrator has this permission
set by default.  I've been using 2000 lately, but I beleive the way to
check/set this in NT is Start-> Administrative Tools ->User Manager.  If
you're on a server you'll need to set the domain to the server name, this
will happen automatically on a workstation.  One of the menu options
somewhere in there is Policies.

--
-

"Giganews" <orl_ando74 at hotmail.com> wrote in message
news:kJRo8.462443$pN4.32187350 at bin8.nnrp.aus1.giganews.com...
> Hey all,
>
> I'm a newbie with Python, and I have been looking for a way to run a
script
> as the administrator on Windows NT.  I have the user name and password,
and
> some code to do the impersonation, but when I try to use it, I receive a
> sort of access denied message.  Upon reading the ActivePython docs, I
found
> that the user who runs the impersonation script needs SE_TCB_NAME,
> SE_CHANGE_NOTIFY_NAME, and SE_ASSIGNPRIMARYTOKEN_NAME priveleges.
>
> Maybe I'm missing the point here, but the only two accounts on these
systems
> with these priveleges are the administrator and the local system account.
> Obviously, if I already were the administrator I wouldn't have this
problem.
> I think I'm missing something.
>
> Anyway, here is the template of the code that I'm having problems with:
>
> admin=win32security.LogonUser('administrator_account','domain','password')
>
> win32security.ImpersonateLoggedOnUser(admin)
>
>
> Has anyone gotten this to work on their systems, if so please help me!  Is
> there another way?
> Any help would be greatly appreciated,
>
> Pablo Manzanera
>
>





More information about the Python-list mailing list