Tech Musings

Friday, June 08, 2007

OS X Default User Template

I normally create a default OS X user template when prepping a master image for deployment. The last few times I've tried this I've run into a snafu or two, so it probably makes sense for me to document it here to jog my memory the next time I do it.

First, it's important to note that I've run into problems using the instructions from Mike Bombich's site here. The last few times I followed these instructions the default user template didn't stick. In fact, I've actually had more luck with the instructions posted by Glenn Rees in this forum post.

1. Tweak your default account including setting dock, clearing cache, recent items, etc. I usually name this account "teacher."

2. Login to the machine as root (I've had problems when I did these steps under a straight admin account as sudo).

3. Create a backup of your current English.lproj template. Don't just issue a mv (move) command to rename it-- create a copy of it using ditto instead.

3. Delete the default home directory files under English.lproj in /System/Library/User\ Template/English.lproj. Don't just delete the entire English.lproj directory!

4. Issue the following commands:

:~root# cd /System/Library/User\ Template/
:~root# sudo ditto -rsrcFork English.lproj/* English.lproj.bak
:~root# sudo rm -rf /System/Library/User\ Template/English.lproj/*
:~root# sudo cp -R /Users/teacher/* /System/Library/User\ Template/English.lproj/
:~root# sudo chown -R root English.lproj
:~root# sudo chgrp -R wheel English.lproj

5. Restart, log in as admin and repair permissions before creating a new account to see if it worked.

I know the sudo commands above are redundant but I just do it as a matter of habit. Slashes and astericks shown in commands above are critical! Also, I've read in some places that permissions on the default user template aren't important but I chown and chgrp on it just to be safe.

13 Comments:

  • When you say: "Delete the default home directory files under English.lproj in /System/Library/User\ Template/English.lproj. Don't just delete the entire English.lproj directory!"

    You mean delete just the contents of the folder not the folder. right?

    The contents I see are:
    Desktop
    Documents
    Library
    Movies
    Pictures
    Public
    Sites

    By Blogger Unknown, at 7:55 PM  

  • Yes, that is correct. Delete all the folders (and files) inside the English.lproj directory.

    By Blogger Jim Epler, at 10:02 AM  

  • Will this work in Leopard?

    By Anonymous Anonymous, at 7:50 PM  

  • I haven't tried it yet in Leopard, although I'm sure I will have the opportunity to do so in the near future. Perhaps someone else who reads this will be able to answer your question before I can answer it.

    By Blogger Jim Epler, at 6:15 AM  

  • I'm the one who asked if it would work in Leopard and after having it tried, I can say that so far, so good, it works well...

    Thanks for the orginal post.

    By Anonymous Anonymous, at 6:15 AM  

  • I'd like to add a few tweaks to this process.

    Before logging out the "teacher" account you should delete login items in Keychain Access and set Finder preferences to open Computer and NOT user's Home or Documents folder. These two items can cause troubles for other users whose templates are based on the "teacher" account.

    By Blogger JoeG, at 12:52 PM  

  • I compress the entire English.lproj folder and I leave the zip in the original location. Then I make my adjustments to the user template, zip this one up (changing the name) and I keep a copy of for my records.

    Even with a Leopard server to pass out plists, sometimes, this is still easier and faster.

    By Blogger Kunes, at 1:28 PM  

  • This is amazing. Thank You so much. I've just completed this process using OS 10.4.11 and it worked like a charm. Everyone in my organization is going to love getting their new computers preset up the little details customized for them.

    By Anonymous Anonymous, at 3:38 PM  

  • Regarding your comment 'Don't just issue a mv (move) command to rename it-- create a copy of it using ditto instead.'

    Can you tell me the reasoning behind this? From my reading, cp and mv handle extended attributes correctly from Tiger on up (although cp needs -p in order to retain all attributes/permissions).

    I just did a quick test with a folder from another user profile on my Mac, using ditto to duplicate the Documents folder to a test folder on my Desktop. Permissions were retained of course. I then used the mv command on the folder at the new location to rename it - permissions still retained.

    Unless I'm missing something?

    thanks, and I hope the post isn't too old for a comment.

    chris

    By Blogger chris, at 8:49 AM  

  • chris-
    I've used ditto from 10.2.x on up because it handled resource forks. My understanding is that the cp command does this in 10.4+, so in some ways it's now a moot point but it does make a difference in relation to how one uses the trailing slash in the command. See this article for more information:

    http://systemsboy.com/2005/12/command-line-smackdown-cp-vs-ditto.html

    By Blogger Jim Epler, at 8:19 AM  

  • Ive gotten this to work on OS X 10.6 the only problem I am having is that it doesnt apply the avatar to all accounts.

    By Anonymous Anonymous, at 8:15 AM  

  • Anonymous said...
    Ive gotten this to work on OS X 10.6 the only problem I am having is that it doesnt apply the avatar to all accounts.

    Anonymous, The avatar for accounts on OS X are configured using the user account information stored in the local directory. The image that is used is stored in the user template, but you then have to tell the account which image to use. Check this out:
    https://discussions.apple.com/thread/2292332?start=0&tstart=0

    By Blogger Rusty Myers, at 5:19 AM  

  • Thanks for the assist on this Jim. And in case anyone is curious, this works on Lion as well.

    By Anonymous Anonymous, at 7:25 AM  

Post a Comment

<< Home