S4 user/group add script

Matthias Dieter Wallnöfer mdw at samba.org
Sat Jun 23 12:39:37 MDT 2012


Hi Ali,
>> Hello,
>>
>> Is there a way to ask S4 to run a script when a user is created via dsa.msc
>> (windows remote administration tool). Of course this script will run samba-
>> tool to really create the user but I would like to create some dirs as
>> well.
>>
>> For the moment I only use samba-tool for the user creation. But using
>> dsa.msc for that as well could be really cool.
>>
>> thanks
> more precision on what I am asking:
> In fact what I really need is to run a command instead of the samba user
> creation.
> For the moment we are running 2 DC (S4 beta2 + s3fs), we are creating users in
> batch mode from a SQL table, and before adding users, a script take care to
> sync the xidNumber by taking the max from each DC. When the user is created,
> it check that the uid/gid is the same on each node otherwise the user is
> deleted and the creation for that user is delayed. If one of the node is not
> ready, the user will be created on the next run of the script. I've tested the
> creation of 1000 users without any problem.
>
> I would like to run the same procedure but for one user added via dsa.msc.
> (we are redirecting a lot of folders so I need more than the home dir as
> well).
>
> Is it possible to place a hook on the samba user add command ?
I don't think that Active Directory does provide such a hook. If you are 
running s4 DCs only you could consider writing one or more LDB modules 
(basically request interceptors) (have a look at the sources under 
"source4/dsdb/samdb/ldb_modules/..."). The new module(s) have to be 
added to "wscript_build" and registered in "samba_dsdb.c". This also 
means that you have to keep the changes as a patch for each new s4 
release which you plan to use. And you will have to manage eventual 
(LDB) API changes done by us - at the moment not so often the case.

Matthias Wallnöfer


More information about the samba-technical mailing list