I want to import some users from a tree in one ldap server to another tree in another ldap server, something like all the entries under ou=accounts,ou=dnsmanager,o=mycompany on 10.0.0.1 to ou=users,dc=mycompany,dc=net on 10.0.0.2. I would rather do this in perl but I'm having some problems. For example 10.0.0.1 uses different schema and ldif files to store users, files that 10.0.0.2 doesn't appear to have. I'm pretty sure those files must exist on both servers but the only thing I can find on 10.0.0.1 are the .schema files. The servers are running on RHEL 5.5 and I have root access on both of them. Any suggestions?
Online approach: For each of the …1 users, read it into a data structure using Net::LDAP
, mangle the data structures to conform to the …2 schema, insert it into the …2 server.
Offline approach: Dump the …1 dataset, mangle the LDIF file to conform to the …2 schema, bulk import it into the …2 server.
Only the .schema
files are mandatory to the running of the server -- if all of the same schemas are in place on the target server, then everything will work just fine, and you can even use ldapsearch
/ldapadd
to do the job. If the same schemas aren't available (even ignoring the .ldif files), and if you can't load the needed schemas on the target server (you say you're admin on both servers, so that could easily be an option!) then you'll need to do as daxim says and somehow modify the data in flight to conform to the target server's schema.