Discussion:
[Samba] Create Organizational units (OU) from Unix.
Prunk Dump
11 years ago
Permalink
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.
Rowland Penny
11 years ago
Permalink
Post by Prunk Dump
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
Prunk Dump
11 years ago
Permalink
...
Thank you very much ! I have just some other questions :

The OU need to be created only in sam.ldb ? and do you know if an OU
created like this will be compatible with RSAT ? There are no more
information stored in the LDB database when the OU is created from
RSAT ?

Thank you again for your help. It will be possible for me now to
complete my scipts to manage my AD completely automatically !

Thanks !

Baptiste.
Rowland Penny
11 years ago
Permalink
...
Sorry, yes you need to create this in sam.ldb i.e.

ldbmodify --url=/path/to/sam.ldb /path/to/ldif

The only other attribute that RSAT (ADUC) adds is 'description', you can
add this if you like.

Rowland
Post by Prunk Dump
Thank you again for your help. It will be possible for me now to
complete my scipts to manage my AD completely automatically !
Thanks !
Baptiste.
Prunk Dump
11 years ago
Permalink
...
Thank you very much !

This is exactly what I want !

Baptiste.

Continue reading on narkive:
Loading...