Generating user home folder in Terminal
I'm exploring bash shell scripting (Terminal) to manage my routine tasks with and have one process that's proving challenging to reproduce in the command line. Occasionally I will need to recreate a Network User's home directory in order to start them with a "clean" account. This involves changing their home folder's location in the Server app (e.g. "None - Services Only"), renaming their old home folder to userName-old, and then setting the location back to its original. Server app then creates a new blank home folder for the user, with the correct internal directories, and I can begin copying over their personal files into it.
But to save myself a bunch of clicking and typing, I want to execute this process via the command line. I'm fairly green at this, but my nearest guess is that I need to run the dscl command to either create or change the user's NFSHomeDirectory entry (source). The resulting commands would read something like this in El Capitan:
sudo dscl . -create /Users/userName NFSHomeDirectory /Users/userName
This seems to do what it's supposed to do. When I follow this up with
dscl
. -read /Users/userName
I see the directory info for the user with the correct path, but no actual home folder is generated in the Finder like what happens in Server app when a blank home folder is created by a path change.
How can I use Terminal commands to replicate this behavior and generate a fresh home folder for an existing user?
Thank you,
Chris
Mac mini, OS X Server