Python LDB authentication via LDAP
amitay at gmail.com
Thu Jan 5 18:39:09 MST 2012
On Fri, Jan 6, 2012 at 11:58 AM, William Brown
<william.e.brown at adelaide.edu.au> wrote:
> I'm currently looking into writing some small python scripts to edit user information in samba4. I have been reading the C code for ldb, but am not quite sure how it authenticates to an ldap backend when used remotely. Any information on how to do this in python would be much appreciated. When used on the domain controller machine, which file should ldb be opening to edit the users partition?
> William Brown
You can use the python framework created for accessing most of the
objects in samba4.
There are plenty of examples in source4/scripting/python/samba/netcmd
example, user.py provides interfaces to manipulate users.
To access AD database, you can use samba.samdb class. The url option specifies
the location of the AD database. It can be either sam.ldb file or
You can get information on various samba python interfaces using pydoc
set PYTHONPATH to the directory containing samba python modules.
Hope that gives you a starting point.
More information about the samba-technical