So I’m migrating to a new server and needed to move all my users and groups over to my new machine.

Here’s how I did it:

1) I installed everything and got the server (slapd) running. Refer to another guide on here that tells you how to do this.
2) use slapcat on old machine to export the database:

slapcat -n 1 > /root/slapcat.dump

3) scp that over to the new machine.
4) Lets format our entries and then go ahead and import them with slapadd.

egrep -v ‘^entryCSN:’ < /root/slapcat.dump > /root/ldapdump # /etc/init.d/slapd stop # slapadd -l /root/ldapdump

5)

/etc/init.d/slapd start

Thats it!

Note: I created the database and created the admin user so i took out anything in my slapcat.dump file regarding that
and only left user and group creation statements.

Mario Loria is a builder of diverse infrastructure with modern workloads on both bare-metal and cloud platforms. He's traversed roles in system administration, network engineering, and DevOps. You can learn more about him here.