[Samba] We need to change our AD domain

L.P.H. van Belle belle at bazuin.nl
Tue Aug 30 07:31:09 UTC 2016



> I understand that Samba doesn't support domain renaming, which is why

> I'm looking for a way to export the data from one domain and import it

> into a new one. 

Export your user/group data to CSV, its not that hard. 


Some things work some dont..  try what you can use. 


Or use CSVDE  ( which i preffer ) 


I used it for exports to csv only, for the import u use the regular tools on the samba server.

Simple user export just open CMD.  Type : CSVDE -f adusers.csv -r "(objectClass=user)"

And check your adusers.csv  


> Sure it would be nice to have a domain rename supported natively but of all the things that still need to be done in

> Samba 4's implementation of AD I don't believe it should be a high priority.


> Domain renames are a fact of life in many organisations, .....  

Yes and No, after almost 15 years field work, i only had 1 company who did this and ended up with lots of problems, 

which we all got fixed, but setting up a new domain and import the users/groups is much quicker and results in a much cleaner AD. 



This is how i imported my users from csv  for the groups and dns records its about the same. 

( The variable change for you ofcourse since the layout can be different. ) 




## Show in AD as example : Louis van Belle

cat users.csv | awk -F "|" '{system("samba-tool user create "$5" --surname=\""$3"\" --given-name=\""$4"\" \

    --department="$1" --mail-address="$7" --telephone-number="$6" --random-password --userou=ou=SOMEOU ") }'



## Shown in ad example :  L.P.H. van Belle

cat users.csv | awk -F ";" '{system("/usr/bin/samba-tool user create "$5" --mail-address="$7" \

--given-name="$2" --surname=\""$3"\" --telephone-number="$6" --department="$1" --description=\""$1"\" \

--random-password --userou=ou=SOMEOU ")}';




Good luck, 







More information about the samba mailing list