Skip to main content
Question

Rename Home Folder

  • November 15, 2017
  • 3 replies
  • 22 views

Forum|alt.badge.img+9

Greetings. Would anyone have a working script to rename a customer's home folder? In our environment Macs are named with the actual user name. (boo-hiss..I know...) And as you can imagine, people's name change ever so often. It's a total manual process and I'm looking to automate it as much as possible. I have changing the computer/host name scripted and working, but the home folder is a different animal. I've read of using dscl . create but not sure if that's needed.

Is it possible to simply rename to the new name and boom, done, as long as the customer is not logged that is? Thanks compadres..

3 replies

justin_smith
Forum|alt.badge.img+8
  • New Contributor
  • November 16, 2017

You would need to remove the user record first using

sudo /usr/bin/dscl . -delete /Users/$youruserhere
rename the home folder to their current name
Make sure the permissions are correct
login as the user


Forum|alt.badge.img+9
  • Author
  • Valued Contributor
  • November 16, 2017

Thanks @justinssmith I'll test that tomorrow!


Forum|alt.badge.img
  • New Contributor
  • January 21, 2020

Hey @steve.summers !

New here! was wondering if you ever found an easier way around this. If so, it'll be great if you can share here. Thanks!