Help needed for initializing SAMR connection against AD

Zahari Zahariev zahari.zahariev at
Thu Jul 9 07:25:17 GMT 2009

Zahari Zahariev wrote:
> Hello team,
> What I am trying to do is to create a simple user in AD and then reset 
> it's password so that I am able to log in with it and do something as 
> that user. This is all to be done with Python bindings for a unittest.
> What I have done is that I create the user which is a breeze -- no 
> problem. Here comes the tricky part when I have to reset the password. 
> Number of ways to do it: Kerberos, SAMR etc. I chose SAMR because 
> there are already Python wrappings for it. There are number of code 
> examples in Samba like:
> source4/scripting/python/examples/
> source4/scripting/python/samba/tests/dcerpc/
> source4/scripting/python/samba/tests/dcerpc/
> I did looked in them all. Although I couldn't figure out how can I 
> authenticate against MS Active Directory server using it and then send 
> request to change password of a given user.
> If someone has any clue I would appreciate it.
> Regards,
> Zahari

Hello everyone,

I found the right way to do this:

    from samba.dcerpc import samr 
    from samba import credentials 
    cred = credentials.Credentials() 
    pipe = samr.samr("ncacn_ip_tcp:ip_addr", credentials=cred)

This popped up from the SummerOfCode lists. Thanks to Andrew it has been brought to my attention.



More information about the samba-technical mailing list