off topic....

winkelhe
New Contributor

this isnt a casper question but i was curious if anyone out there new how to change the default location for home folders. i'm looking to use the accounts pane in system prefs to create users but automatically have the home folder made in a non standard location. i know i can specify a location when using casper to create an account and i know i can change it after the fact but i want to have it as the default.

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

14 REPLIES 14

stevewood
Honored Contributor II
Honored Contributor II

You could do it via script or Terminal using the dscl command. You can set
the home directory path there if it is a local user. Not sure if you could
do it with a network user or not.

This is an example of a user I create on all machines:

dscl . create /users/arduser
dscl . create /users/arduser name arduser
dscl . create /users/arduser passwd "*"
dscl . create /users/arduser uid 499
dscl . create /users/arduser gid 499
dscl . create /users/arduser home /var
dscl . create /users/arduser shell /bin/bash
dscl . merge /groups/admin users arduser

Steve Wood
Director of IT
swood at integer.com

The Integer Group | 1999 Bryan St. | Ste. 1700 | Dallas, TX 75201
T 214.758.6813 | F 214.758.6901 | C 940.312.2475

tlarkin
Honored Contributor

To add to what Mr Wood already stated you can do it a couple of ways....

You can edit the user profile by creating a user, setting it up exactly
how you want it, and then taking that default profile and replacing it
overriding the system template. Then all new accounts created will
follow that template.

besides from the dscl command the Jamf binary has this built in....

I have a script, post image process, that creates two local accounts in
/prviate/var that are hidden local admin accounts. Example command:

/usr/sbin/jamf createAccount -username "$admin1_short" -realname
"$admin1_long" -password "$admin1_passwd" –home
/private/var/$admin1_short –shell “/bin/bash” -hiddenUser -admin

Now the admin variables I hard code in the script, so you would want to
put actual information in there. I can send you my post image script if
you want to take a gander at it.

I would consider this on topic, since you would use Casper to do this.

winkelhe
New Contributor

yeah i know i can do it with dscl too. i'm tied to AD and an account is created with a mobile home at login. i want that home in a non standard place.

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

winkelhe
New Contributor

let's forget all about creating a user via command line using dscl or jamf, i know i can do that. it's my field techs that can't and again i am tied to AD which creates accounts and homes when a user logs in. tell me more of this default user profile you speak of. i mean, i imagine there is one but i can't seem to find it. viewing and copying a user's profile in dscl is no problem but where is the template that the system uses so i can replace it?

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

Not applicable

/System/Library/User Template/English.lproj/

--

James Alcasíd | VeriSolv Technologies
Department of Veterans Affairs | Enterprise Infrastructure Engineering
470 L'Enfant Plaza Suite 3100, Washington DC 20024
Office (202) 245-4573

Note:
This message is for the named person's use only. It may contain
confidential, proprietary or legally privileged information. No
confidentiality or privilege is waived or lost by any mis-transmission. If
you receive this message in error, immediately delete it and all copies of
it from your system, destroy any hard copies of it and notify the sender.
You must not, directly or indirectly, use, disclose, distribute, print, or
copy any part of this message if you are not the intended recipient. Any
views expressed in this message are those of the individual sender, except
where the message states otherwise and the sender is authorized to state
them to be the views of any such entity.

tlarkin
Honored Contributor

Eric,

I am not an ace at this because I don't fuss with the user template, but
I know the "concept" of how to work it. You basically have the user
template, that whenever a use account is created be it local, network,
portable, AD, OD, ED, or whatever, it looks to the user template to
create the home directory. This is located in /System/Library/User
Template/English.lproj and you want to modify it to fit your needs. You
can most likely do this via MCX to be honest but I have no clue on how
to do that. However, if you modify that file in your image, or via a
script, then every user will follow that template.

There are some caveats with this method as you don't want to do things
like set a keychain password for all users, google came up with this
quick and dirty guide:

http://www.makemacwork.com/customize-the-user-template.htm

So you will basically copy the whole user account of
/Users/mytemplateuser/* to the path of where the template is stored in
/System.

I hope that makes sense.

Tom

winkelhe
New Contributor

yeah that's the default contents of the home folder, not the default location.

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

winkelhe
New Contributor

yes. i've been creating custom default home folders for years, very familiar. now, how do i get the OS to create that home folder somewhere other than /Users???

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

tlarkin
Honored Contributor

I assume if you create a very basic AD user in
/Domains/mydomain/mydomain_user and then copy those contents to the
system folder template, it should follow the file paths I believem, but
maybe it doesn't???. Like I said, I haven't fussed with it much. The
other way would be some scripting and log in hooks using something like
this:

dscl . change dsAttrTypeNative:home /Users/user
/Volumes/external/homes/user

Something along those lines, my syntax is probably off. You could
script that as a log in hook then force a reboot?

winkelhe
New Contributor

anything you place in English.lproj is copied into /Users/user, it won't follow any path. you might be on to something with the login hook, i'll have to test it out cause the home folder is being created at login. i'm not sure when exactly the hook runs, if it's immediatly after authentication it wont work since the account and home folder creation takes a good 30 seconds to finish so the command would probably error out. the script would have to insert the name of the user who just logged in and also the newly created home folder would have to be moved and moving a user's home while they're logged in doesnt sound to good. just thinking out loud......

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

tlarkin
Honored Contributor

dscl is the command to set the home folder path, you can change or append that attribute so it points to a different directory. That or symbolic links?

I would have sworn I read that you can edit the user template so that it changes the path as well...

I know there has to be a way to set this in OD somewhere, with MCX in WGM, but I can't quite wrap my head around it.



Thomas Larkin
TIS Department
KCKPS USD500
tlarki at kckps.org
blackberry: 913-449-7589
office: 913-627-0351
chown -R us /.base

winkelhe
New Contributor

ok, ok, i've been thinking about this all wrong. for anyone who is interested i decided to stop trying to find some conf file to edit and change where the OS wants to put the home. i reversed my thinking and mounted the user data partition at /Users. bam, done. only been testing for a little while but it all seems fine. i used to link personal stuff like moves, pictures and music to the data volume but we would still have to back up whatever the user placed all around his home folder. no more of that crap.

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

winkelhe
New Contributor

awwww...shit, son! upon further review......

Thanks for the help everyone.

eric winkelhake
mundocomww
office 312 220 1669
cell 312 504 5155

taugust04
Valued Contributor

Be sure to test all your applications before deploying your changes. I'm pretty sure there are still applications out there that do not like the home directory anywhere other than /Users/username.

-- Ted August
Salve Regina University