Zentyal Forum, Linux Small Business Server
Zentyal Server => Directory and Authentication => Topic started by: ATT1 on September 22, 2019, 06:21:55 pm
-
Hello,
I have the need to freshly install a new Zentyal 6 on some machine and then to add all the existing users from an existing old Zentyal 4.1 installation, which exists on the old machine.
Somehow I would not want to manually add all users again.
Is there a script or something like that, which will add all users, including all their previous passwords and groups, to a new Zentyal 6 installation from an existing Zentyal 4.1 installation ?
-
:)
In your old Zentyal server:
sudo ldbsearch -H /var/lib/samba/private/sam.ldb '(&(objectclass=user)(!(isCriticalSystemObject=TRUE)))' >> users.ldif
This users.ldif have to be cleaned by removing some of the lines (ldbadd will help you when importing telling you the lines which you have to remove for each one of the records).
sed -i '/^#/d' users.ldif
...
# do the same for lines which begin with GENSEC, primaryGroupID, sAMAccountType,
# objectGUID, pwdLastSet, memberOf and any other that ldbadd will complain about it.
# It depends on the modules which you have used on Zentyal 4.0 and the modules which
# you have enabled in Zentyal 6.0 before to do this task
Use this command in order to view the next uid and gid which you have to use for your new users:
for i in `wbinfo -u`;do getent passwd $i | cut -d ":" -f 1,3,4 ;done;
Copy the users.ldif file on your new Zentyal 6.0:
sudo ldbadd -U lab6.lan/lacayo%lacayo -H ldap://zen6.lab6.lan users.ldif
# lab6.lan is my domain name
# lacayo is an Domain Administrator account that I have created on Webadmin with password 'lacayo'
# zen6 is my hostname
# users.ldif the fiel which you have copied
Check your new users:
sudo wbinfo -u
Use smbpasswd in order to re-new the passwords for each one of the users.
You should be able to view your users in your new Zentyal
Cheers!
-
Oh. My. God.
I think adding all users again, including all their groups and all their "fetch external email" is easier..... :-(
-
Oh. My. God.
I think adding all users again, including all their groups and all their "fetch external email" is easier..... :-(
Really it's not so difficult, but actually, this way of doing doesn't introduce the groups (you'll have to do with groups the same process) ;)
Cheers!