Version 3 (modified by jsalamero@…, 3 years ago) (diff)

--

How To Migrate Users

On this howto will explain how to migrate users (just basic user atributes, not module objects and attributes) from one eBox to an other.

  • First we have to get the ebox LDAP user password:
$ sudo cat /var/lib/ebox/conf/ebox-ldap.passwd
XXXXXX
  • Dump the users Organizational Unit from LDAP to a ldif file (use the password we got from last command):
$ ldapsearch -D 'cn=ebox,dc=hostname,dc=tld' -b 'ou=Users,dc=hostname,dc=tld' -W > users.ldif
Enter LDAP Password:
  • Delete objects and attributes added by third party modules, like ebox-mail on this case:
$ sed -i /^mail:/d users.ldif
$ sed -i /^mailbox:/d users.ldif
$ sed -i /^quota:/d users.ldif
$ sed -i /^mailHomeDirectory:/d users.ldif
$ sed -i /^objectClass:\ CourierMailAccount/d users.ldif
$ sed -i /^objectClass:\ usereboxmail/d users.ldif
  • Delete Users Organizational Unit at the top of the file and query result info at the bottom:
# Users, ebox-technologies.com
dn: ou=Users,dc=ebox-technologies,dc=com
objectClass: organizationalUnit
ou: Users
# search result
search: 2
result: 0 Success

# numResponses: 14
# numEntries: 13
  • Now we need to get the ebox LDAP password on the new host:
$ cat /var/lib/ebox/conf/ebox-ldap.passwd
ZZZZZZZZ
  • And to finish just import the ldif file into LDAP with the password from last command:
$ ldapadd -D 'cn=ebox,dc=hostname,dc=tld' -W -f users.ldif
Enter LDAP Password:
adding new entry "uid=jsalamero,ou=Users,dc=hostname,dc=tld"
  • For the groups we have to make something very similar, first we dump to a ldif file:
ldapsearch -D 'cn=ebox,dc=hostname,dc=tld' -b 'ou=Groups,dc=hostname,dc=tld' -W > groups.ldif
Enter LDAP Password:
  • Then we delete the first and last part like in the users file, and to finish we import the ldif file:
 ldapadd -D 'cn=ebox,dc=hostname,dc=tld' -W -f groups.ldif
Enter LDAP Password:
adding new entry "cn=eboxers,ou=Groups,dc=hostname,dc=tld"