I created an OpenLDAP server on Ubuntu 22.04, and created users but forgot to add them to a organizational unit (ou). How can I associate them all to an ou now ?
The actual server looks like this:
dn=company
ou=Users
uid=user1
uid=user2
uid=user3
...
What I would like is:
dn=company
ou=Users
uid=user1
uid=user2
uid=user3
...
Concretely, I would like to go from this:
uid=user1,dc=example,dc=fr
to this:
uid=user1,ou=Users,dc=example,dc=fr
2
Answers
Actually I just found an answer on my own. I simply did a LDIF file
modify.ldif
:And then
ldapmodify -x -D cn=admin,dc=example,dc=fr -W -f ./modify.ldif
Adding an
ou
attribute to the entry is one thing, moving the entry in the DIT is another thing. For the latter, you need to use thenewsuperior
directive.Using
ldapmodify -f
withchangetype: (modrdn|moddn)
:Using
ldapmodrdn -r -s <newsuperior> <dn> <newrdn>
: