ldapopenldapldif

OpenLDAP associate existing users to an organization unit (OU)


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

Solution

  • 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 the newsuperior directive.