Skip to content

Instantly share code, notes, and snippets.

@suoko
Last active June 5, 2017 20:08
Show Gist options
  • Save suoko/31eca1dd0552dd6cfb23c70e9468af1e to your computer and use it in GitHub Desktop.
Save suoko/31eca1dd0552dd6cfb23c70e9468af1e to your computer and use it in GitHub Desktop.
OS X active directory domain migration
Login as admin user and list users:
ls -alh /Users/
Move domain User folders to .old:
sudo mv /Users/johndoe /Users/johndoe.old
Unbind Machine:
Preferences -> Accounts-> Login Options-> Network account server -> Directory utility -> Active directory -> Unbind
Delete sqlindex files found in ls /var/db/dslocal/nodes/Default/
sudo rm -f /var/db/dslocal/nodes/Default/sqlindex
sudo rm -f /var/db/dslocal/nodes/Default/sqlindex-shm
sudo rm -f /var/db/dslocal/nodes/Default/sqlindex-wal
Reboot
Bind to new domain:
Preferences -> Accounts -> Login Options -> Network account server -> Directory utility -> Active directory -> Bind
Reboot
Login as user
Logout and login as admin:
Move User folder .new After you have logged in as the user under the new domain you need to move the newly created User home folder to johndoe.new and move the .old User folder to /Users/johndoe with the command:
sudo mv /Users/johndoe /Users/johndoe.new
Move .old to new username:
sudo mv /Users/johndoe.old /Users/johndoe
Change ownership of /Users/johndoe, /Applications, /usr/local and /private folders (change DomainName according to your domain name. Change group id (1212121212) and user id (1313131313) according to results of command "ls -l" executed in the home):
sudo find . -group 1212121212 -exec chgrp -Rh "DomainName\Domain Users" {} \;
sudo find . -user 1313131313 -exec chown -Rh johndoe {} \;
Logout as admin
Reboot
Login as that user (johndoe)
Click on “Create a new keychain” much easier in El Capitan and Yosemite If “Create new Keychain” fails then goto Keychain Access –> Preferences –> Reset Default Keychain
Thanks to https://jasoncoltrin.com/2016/05/07/os-x-new-domain-migration-retaining-user-profile-with-scripts/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment