[Samba] Create Organizational units (OU) from Unix.

Rowland Penny rowlandpenny at googlemail.com
Mon Sep 22 11:22:58 MDT 2014


On 22/09/14 17:32, Prunk Dump wrote:
> Hello,
>
> Is there a way to create an OU (in the AD sence) from Unix with the
> samba tools ?
>
> I have made a script that create all my users and groups (for a
> school). But I still need to create the OUs manually from windows with
> RSAT.
>
> Thanks.
>
> Baptiste.
You need to script around an ldif similar to this:

dn: OU_PATH,dc=example,dc=com
changetype: add
objectClass: top
objectClass: organizationalunit

You then add this with ldbmodify, but with one proviso, you can only 
create one OU at a time unless you do it with multiple stanzas
i.e. using a DN of ou=secondou,ou=firstou,dc=home,dc=com would fail 
unless ou=firstou,dc=home,dc=com already existed, but an ldif such as:

dn: firstou,dc=example,dc=com
changetype: add
objectClass: top
objectClass: organizationalunit

dn: ou=secondou,ou=firstou,dc=example,dc=com
changetype: add
objectClass: top
objectClass: organizationalunit

  would work as firstou would be created before secondou.

Rowland



More information about the samba mailing list